FormatUtil { public static String toUnsignedString(int i) { if (i >= 0) { return Integer.toString(i); } return Long.toString(getUnsignedInt(i)); } 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 testToUnsignedString() { assertEquals("1", FormatUtil.toUnsignedString(0x00000001)); assertEquals("2147483648", FormatUtil.toUnsignedString(0x80000000)); assertEquals("4294967295", FormatUtil.toUnsignedString(0xffffffff)); assertEquals("1", FormatUtil.toUnsignedString(0x0000000000000001L)); assertEquals("9223372036854775808", FormatUtil.toUnsignedString(0x8000000000000000L)); assertEquals("18446744073709551615", FormatUtil.toUnsignedString(0xffffffffffffffffL)); }