HexString { public static String toHexString(long val, int padTo) { char arr[] = Long.toHexString(val).toCharArray(); String ret = ""; int i = 0; for (; i < (padTo * 2 - arr.length); i++) { ret += "0"; } for (int j = 0; j < arr.length; j++) { ret += arr[j]; } return ret; }  static String toHexString(long val, int padTo); static String toHexString(long val); static byte[] fromHexString(String values); static long toLong(String values);  }
@Test public void testToHexString() throws Exception { Assert.assertTrue(HexString.toHexString(1L,6) != null); Assert.assertTrue(HexString.toHexString(1L) != null); }