code: public long getUsableSpace() {
          try {
              StructStatVfs sb = Libcore.os.statvfs(path);
              return sb.f_bavail * sb.f_bsize; // non-root free block count * block size in bytes.
          } catch (ErrnoException errnoException) {
              return 0;
          }
      }
docs: Returns the number of usable 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.
  On Android (and other Unix-based systems), this method returns the number of free bytes
  available to non-root users, regardless of whether you're actually running as root,
  and regardless of any quota or other restrictions that might apply to the user.
  (The {@code getFreeSpace} method returns the number of bytes potentially available to root.)
  
  @since 1.6