mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 17:48:33 +00:00
Use decimal digit groups in file size pretty printing.
This commit is contained in:
parent
977591ac82
commit
a0ecba147e
@ -539,9 +539,9 @@ public class Util {
|
|||||||
if (sizeBytes <= 0) return "0";
|
if (sizeBytes <= 0) return "0";
|
||||||
|
|
||||||
String[] units = new String[]{"B", "kB", "MB", "GB", "TB"};
|
String[] units = new String[]{"B", "kB", "MB", "GB", "TB"};
|
||||||
int digitGroups = (int) (Math.log10(sizeBytes) / Math.log10(1024));
|
int digitGroups = (int) (Math.log10(sizeBytes) / 3);
|
||||||
|
|
||||||
return new DecimalFormat("#,##0.#").format(sizeBytes/Math.pow(1024, digitGroups)) + " " + units[digitGroups];
|
return new DecimalFormat("#,##0.#").format(sizeBytes/Math.pow(1000, digitGroups)) + " " + units[digitGroups];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sleep(long millis) {
|
public static void sleep(long millis) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user