code: public static long getFileSize(String path) {
      File file = new File(path);
      if (file.exists()) {
        if (file.isFile()) {
          return file.length();
        } else {
          long size = 0;
          File[] files = file.listFiles();
          if (files != null && files.length > 0) {
            for (File temp : files) {
              if (temp.isFile()) {
                size += temp.length();
              }
            }
          }
          return size;
        }
      }
      return 0;
    }
docs: 查看文件或者文件夹大小