MCPcopy Index your code
hub / github.com/oshi/oshi / formatBytesDecimal

Method formatBytesDecimal

oshi-core/src/main/java/oshi/util/FormatUtil.java:130–138  ·  view source on GitHub ↗

Format bytes into a rounded string representation using decimal SI units. These are used by hard drive manufacturers for capacity. Most other storage should use #formatBytes(long). @param bytes Bytes. @return Rounded string representation of the byte size.

(long bytes)

Source from the content-addressed store, hash-verified

128 * @return Rounded string representation of the byte size.
129 */
130 public static String formatBytesDecimal(long bytes) {
131 if (bytes == 1L) { // bytes
132 return String.format("%d byte", bytes);
133 } else if (bytes < KILO) { // bytes
134 return String.format("%d bytes", bytes);
135 } else {
136 return formatValue(bytes, "B");
137 }
138 }
139
140 /**
141 * Format hertz into a string to a rounded string representation.

Callers 4

toStringMethod · 0.95
toStringMethod · 0.95

Calls 1

formatValueMethod · 0.95