public static long getFreeDiskSpace(final File dir) {
        if (dir == null) {
            return 0;
        }
        try {
            final StatFs statFs = new StatFs(dir.getAbsolutePath());
            return statFs.getAvailableBlocksLong() * statFs.getBlockSizeLong();
        } catch (final IllegalArgumentException ignored) {
            // thrown if the directory isn't pointing to an external storage
        }
        return 0;
    }
Returns the available space in bytes on the mount point used by the given dir.
main/src/main/java/cgeo/geocaching/utils/FileUtils.java