diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java index bf8e57331f..abd183788a 100644 --- a/app/src/main/java/eu/faircode/email/Helper.java +++ b/app/src/main/java/eu/faircode/email/Helper.java @@ -387,12 +387,14 @@ public class Helper { // Formatting + private static final DecimalFormat df = new DecimalFormat("@@"); + static String humanReadableByteCount(long bytes, boolean si) { int unit = si ? 1000 : 1024; if (bytes < unit) return bytes + " B"; int exp = (int) (Math.log(bytes) / Math.log(unit)); String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i"); - return new DecimalFormat("@@").format(bytes / Math.pow(unit, exp)) + " " + pre + "B"; + return df.format(bytes / Math.pow(unit, exp)) + " " + pre + "B"; } // https://issuetracker.google.com/issues/37054851