public static long getSize(final File file) {
        if (file == null || !file.exists()) {
            return 0;
        }
        if (file.isDirectory()) {
            long result = 0;
            final File[] fileList = file.listFiles();
            if (ArrayUtils.isNotEmpty(fileList)) {
                for (final File aFileList : fileList) {
                    result += getSize(aFileList);
                }
            }
            return result; // return the file size
        }
        return file.length();
    }
Returns the size in bytes of a file or directory.
main/src/main/java/cgeo/geocaching/utils/FileUtils.java