Hex { public static String u2or4(int v) { if (v == (char) v) { return u2(v); } else { return u4(v); } } private  Hex(); static String u8(long v); static String u4(int v); static String u3(int v); static String u2(int v); static String u2or4(int v); static String u1(int v); static String uNibble(int v); static String s8(long v); static String s4(int v); static String s2(int v); static String s1(int v); static String dump(byte[] arr, int offset, int length,
                              int outOffset, int bpl, int addressLength);  }
@Test public void testU2or4() { Assert.assertEquals("0000", Hex.u2or4(0)); Assert.assertEquals("04d2", Hex.u2or4(1234)); Assert.assertEquals("0001e240", Hex.u2or4(123456)); Assert.assertEquals("00bc614e", Hex.u2or4(12345678)); Assert.assertEquals("499602d2", Hex.u2or4(1234567890)); }