mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-26 07:32:08 +01:00
Small improvement
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user