MCPcopy Create free account
hub / github.com/VolmitSoftware/Adapt / memx

Method memx

src/main/java/com/volmit/adapt/util/Form.java:984–998  ·  view source on GitHub ↗

Get a formatted representation of the memory given in kilobytes @param mb the kilobytes @return the string representation with suffixes

(long kb)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

fdMethod · 0.95

Tested by

no test coverage detected