code: public long getFreeSpace() {
          try {
              StructStatVfs sb = Libcore.os.statvfs(path);
              return sb.f_bfree * sb.f_bsize; // free block count * block size in bytes.
          } catch (ErrnoException errnoException) {
              return 0;
          }
      }
docs: Returns the number of free bytes on the partition containing this path.
  Returns 0 if this path does not exist.
  
  <p>Note that this is likely to be an optimistic over-estimate and should not
  be taken as a guarantee your application can actually write this many bytes.
  
  @since 1.6