@Test public void getSectorTestTB() { String testRequestSize = "1099511627776"; String testSectorSize = "512"; long result = HFSUtils.getNumSector(testRequestSize, testSectorSize); assertEquals(2179753739L, result); }
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; Double allocBitmapSize = nSectors / 8; Double extOverflowFileSize = memSize100GB * 1024 * 1024 * 4; Double journalFileSize = memSize100GB * 1024 * 1024 * 8; Double catalogFileSize = memSizeKB * 10; Double hotFileSize = memSizeKB * 5; 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); return numSectors.longValue() + 1; }
HFSUtils { 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; Double allocBitmapSize = nSectors / 8; Double extOverflowFileSize = memSize100GB * 1024 * 1024 * 4; Double journalFileSize = memSize100GB * 1024 * 1024 * 8; Double catalogFileSize = memSizeKB * 10; Double hotFileSize = memSizeKB * 5; 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); return numSectors.longValue() + 1; } }
HFSUtils { 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; Double allocBitmapSize = nSectors / 8; Double extOverflowFileSize = memSize100GB * 1024 * 1024 * 4; Double journalFileSize = memSize100GB * 1024 * 1024 * 8; Double catalogFileSize = memSizeKB * 10; Double hotFileSize = memSizeKB * 5; 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); return numSectors.longValue() + 1; } private  HFSUtils(); }
HFSUtils { 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; Double allocBitmapSize = nSectors / 8; Double extOverflowFileSize = memSize100GB * 1024 * 1024 * 4; Double journalFileSize = memSize100GB * 1024 * 1024 * 8; Double catalogFileSize = memSizeKB * 10; Double hotFileSize = memSizeKB * 5; 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); return numSectors.longValue() + 1; } private  HFSUtils(); static long getNumSector(String requestSize, String sectorSize); static void main(String[] args); }
HFSUtils { 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; Double allocBitmapSize = nSectors / 8; Double extOverflowFileSize = memSize100GB * 1024 * 1024 * 4; Double journalFileSize = memSize100GB * 1024 * 1024 * 8; Double catalogFileSize = memSizeKB * 10; Double hotFileSize = memSizeKB * 5; 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); return numSectors.longValue() + 1; } private  HFSUtils(); static long getNumSector(String requestSize, String sectorSize); static void main(String[] args);  }