### Question:
Memory { public static String formatMemorySize(long memorySizeBytes) { StringBuilder builder = new StringBuilder(); MemSize best = MemSize.getBestMemSize(memorySizeBytes); double value = MemSize.getBestMemSizeValue(memorySizeBytes, best); DecimalFormat df = new DecimalFormat("##.#"); builder.append(df.format(value)); builder.append(best.entity); return builder.toString(); }  static String formatMemorySize(long memorySizeBytes);  }### Answer:
@Test public void testFormatMemorySize() { Object[][] mems = { { (long) 1024, "1kB" }, { (long) (255 * 255 * 255), "15.8MB" } }; Locale savedLocale = Locale.getDefault(); try { Locale.setDefault(Locale.US); for (Object[] tmp : mems) { String formattedString = Memory.formatMemorySize((Long) tmp[0]); System.out.println(formattedString); Assert.assertEquals(tmp[1], formattedString); } } finally { Locale.setDefault(savedLocale); } }