FormatUtil { public static String formatHertz(long hertz) { return formatValue(hertz, "Hz"); } private  FormatUtil(); static String formatBytes(long bytes); static String formatBytesDecimal(long bytes); static String formatHertz(long hertz); static String formatValue(long value, String unit); static String formatElapsedSecs(long secs); static float round(float d, int decimalPlace); static long getUnsignedInt(int x); static String toUnsignedString(int i); static String toUnsignedString(long l); static String formatError(int errorCode); static final String HEX_ERROR; }
@Test public void testFormatHertz() { assertEquals("0 Hz", FormatUtil.formatHertz(0)); assertEquals("1 Hz", FormatUtil.formatHertz(1)); assertEquals("999 Hz", FormatUtil.formatHertz(999)); assertEquals("1 KHz", FormatUtil.formatHertz(1000)); assertEquals("1 MHz", FormatUtil.formatHertz(1000 * 1000)); assertEquals("1 GHz", FormatUtil.formatHertz(1000 * 1000 * 1000)); assertEquals("1 THz", FormatUtil.formatHertz(1000L * 1000L * 1000L * 1000L)); }