From 30bc5a90f5cd08c9026b0a2102b31e811458f559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Navarro=20Fern=C3=A1ndez?= Date: Mon, 19 Dec 2016 17:06:31 +0100 Subject: [PATCH] Update StringUtil.java Added TB --- .../main/java/org/libresonic/player/util/StringUtil.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libresonic-main/src/main/java/org/libresonic/player/util/StringUtil.java b/libresonic-main/src/main/java/org/libresonic/player/util/StringUtil.java index 3e3ced4f..b5124b91 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/util/StringUtil.java +++ b/libresonic-main/src/main/java/org/libresonic/player/util/StringUtil.java @@ -212,6 +212,12 @@ public final class StringUtil { */ public static synchronized String formatBytes(long byteCount, Locale locale) { + // More than 1 TB? + if (byteCount >= 1024 * 1024 * 1024 * 1024) { + NumberFormat teraByteFormat = new DecimalFormat("0.00 TB", new DecimalFormatSymbols(locale)); + return teraByteFormat.format((double) byteCount / (1024 * 1024 * 1024 * 1024)); + } + // More than 1 GB? if (byteCount >= 1024 * 1024 * 1024) { NumberFormat gigaByteFormat = new DecimalFormat("0.00 GB", new DecimalFormatSymbols(locale)); @@ -546,4 +552,4 @@ public final class StringUtil { } return s.replaceAll("<.*?>", ""); } -} \ No newline at end of file +}