code: public static long getNumSector(String requestSize, String sectorSize) {
      Double memSize = Double.parseDouble(requestSize);
      Double sectorBytes = Double.parseDouble(sectorSize);
      Double nSectors = memSize / sectorBytes;
      Double memSizeKB = memSize / 1024;
      Double memSizeGB = memSize / (1024 * 1024 * 1024);
      Double memSize100GB = memSizeGB / 100;
  
      // allocation bitmap file: one bit per sector
      Double allocBitmapSize = nSectors / 8;
  
      // extend overflow file: 4MB, plus 4MB per 100GB
      Double extOverflowFileSize = memSize100GB * 1024 * 1024 * 4;
  
      // journal file: 8MB, plus 8MB per 100GB
      Double journalFileSize = memSize100GB * 1024 * 1024 * 8;
  
      // catalog file: 10bytes per KB
      Double catalogFileSize = memSizeKB * 10;
  
      // hot files: 5bytes per KB
      Double hotFileSize = memSizeKB * 5;
  
      // quota users file and quota groups file
      Double quotaUsersFileSize = (memSizeGB * 256 + 1) * 64;
      Double quotaGroupsFileSize = (memSizeGB * 32 + 1) * 64;
      Double metadataSize = allocBitmapSize + extOverflowFileSize + journalFileSize
          + catalogFileSize + hotFileSize + quotaUsersFileSize + quotaGroupsFileSize;
  
      Double allocSize = memSize + metadataSize;
      Double numSectors = allocSize / sectorBytes;
  
      System.out.println(numSectors.longValue() + 1); // round up
      return numSectors.longValue() + 1;
    }
docs: Converts the memory size to number of sectors.
  
  @param requestSize requested filesystem size in bytes
  @param sectorSize the size of each sector in bytes
  @return total sectors of HFS+ including estimated metadata zone size