File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323 */
2424
2525package string ;
26+
27+ import java .util .Locale ;
2628
2729/**
2830 * FormatBytesSnippet.
@@ -44,13 +46,13 @@ public static String formatBytes(long bytes) {
4446 if ((bytes >= 0 ) && (bytes < kb )) {
4547 return bytes + " B" ;
4648 } else if ((bytes >= kb ) && (bytes < mb )) {
47- return String .format ("%.2f KB" , bytes / kb );
49+ return String .format (Locale . ENGLISH , "%.2f KB" , bytes / kb );
4850 } else if ((bytes >= mb ) && (bytes < gb )) {
49- return String .format ("%.2f MB" , bytes / mb );
51+ return String .format (Locale . ENGLISH , "%.2f MB" , bytes / mb );
5052 } else if ((bytes >= gb ) && (bytes < tb )) {
51- return String .format ("%.2f GB" , bytes / gb );
53+ return String .format (Locale . ENGLISH , "%.2f GB" , bytes / gb );
5254 } else if (bytes >= tb ) {
53- return String .format ("%.2f TB" , bytes / tb );
55+ return String .format (Locale . ENGLISH , "%.2f TB" , bytes / tb );
5456 } else {
5557 return "Invalid Input" ;
5658 }
You can’t perform that action at this time.
0 commit comments