Get a formatted representation of the memory given in kilobytes @param mb the kilobytes @return the string representation with suffixes
(long kb)
| 982 | * @return the string representation with suffixes |
| 983 | */ |
| 984 | public static String memx(long kb) { |
| 985 | if (kb < 1024) { |
| 986 | return fd(kb, 2) + " KB"; |
| 987 | } else { |
| 988 | double mb = (double) kb / 1024.0; |
| 989 | |
| 990 | if (mb < 1024) { |
| 991 | return fd(mb, 2) + " MB"; |
| 992 | } else { |
| 993 | double gb = mb / 1024.0; |
| 994 | |
| 995 | return fd(gb, 2) + " GB"; |
| 996 | } |
| 997 | } |
| 998 | } |
| 999 | |
| 1000 | /** |
| 1001 | * Format a long. Changes -10334 into -10,334 |