Format units as exact integer or fractional decimal based on the prefix, appending the appropriate units @param value The value to format @param prefix The divisor of the unit multiplier @param unit A string representing the units @return A string with the value
(long value, long prefix, String unit)
| 112 | * @return A string with the value |
| 113 | */ |
| 114 | private static String formatUnits(long value, long prefix, String unit) { |
| 115 | if (value % prefix == 0) { |
| 116 | return String.format("%d %s", value / prefix, unit); |
| 117 | } |
| 118 | return String.format("%.1f %s", (double) value / prefix, unit); |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * Format bytes into a rounded string representation using decimal SI units. |
no outgoing calls
no test coverage detected