List of utility methods to do Long Format
String | getDisplayable(long numBytes) get Displayable if (numBytes < BYTES_SCALING_FACTOR) { return numBytes + " bytes"; String label; double size = ((double) numBytes) / BYTES_SCALING_FACTOR; if (size < BYTES_SCALING_FACTOR) { label = "Kb"; } else { ... |
String | formatByte(long l) format Byte String s = "0 KB"; if (l <= 0x100000L) { BigDecimal bigdecimal = new BigDecimal(l); BigDecimal bigdecimal1 = new BigDecimal(1024); RoundingMode roundingmode = RoundingMode.CEILING; String s1 = String.valueOf(bigdecimal.divide(bigdecimal1, 0, roundingmode).toString()); s = (new StringBuilder(s1)).append(" KB").toString(); ... |
String | formatFromSize(long size) format From Size if (size == -1) return ""; String suffix = " B"; if (size >= 1024) { suffix = " KB"; size /= 1024; if (size >= 1024) { suffix = " MB"; ... |