We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b66ff31 commit 1a58716Copy full SHA for 1a58716
src/main/java/org/scijava/util/UnitUtils.java
@@ -66,9 +66,14 @@ public static String getAbbreviatedByteLabel(final double totBytes) {
66
// compute value from unit
67
final double value = totBytes / Math.pow(1024.0, pow);
68
69
- // format result with 0 decimal places for bytes, or 1 for larger values
70
- final String format = pow == 0 ? "%.0f%s" : "%.1f%s";
+ final String format = format(pow);
71
return String.format(format, value, BYTE_UNITS[pow]);
72
}
73
+ /**
74
+ * @return Format result with 0 decimal places for bytes, or 1 for larger values
75
+ */
76
+ public static String format(final double power) {
77
+ return power == 0 ? "%.0f%s" : "%.1f%s";
78
+ }
79
0 commit comments