code: public long getTotalSpace() {
          try {
              StructStatVfs sb = Libcore.os.statvfs(path);
              return sb.f_blocks * sb.f_bsize; // total block count * block size in bytes.
          } catch (ErrnoException errnoException) {
              return 0;
          }
      }
docs: Returns the total size in bytes of the partition containing this path.
  Returns 0 if this path does not exist.
  
  @since 1.6