From 0f9734c7bd547d4c3fe6f5c2e65f5aff81a8ac52 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 10 Oct 2019 15:09:40 +0200 Subject: [PATCH] Small improvement --- app/src/main/java/eu/faircode/email/Helper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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