HexString { private HexString() { assert false; } private  HexString(); @Nonnull static String getHexString(@Nonnull final String textValue); @Nonnull static String getHexString(@Nonnull final byte[] bytes); @Nonnull static byte[] getHexByteArray(@Nonnull final String hexValue);  }
@Test public void testHexString() { LOG.info("testHexString"); Assert.assertEquals("00", HexString.getHexString(new byte[]{(byte) 0})); Assert.assertEquals("01", HexString.getHexString(new byte[]{(byte) 1})); Assert.assertEquals("02", HexString.getHexString(new byte[]{(byte) 2})); Assert.assertEquals("03", HexString.getHexString(new byte[]{(byte) 3})); Assert.assertEquals("04", HexString.getHexString(new byte[]{(byte) 4})); Assert.assertEquals("05", HexString.getHexString(new byte[]{(byte) 5})); Assert.assertEquals("06", HexString.getHexString(new byte[]{(byte) 6})); Assert.assertEquals("07", HexString.getHexString(new byte[]{(byte) 7})); Assert.assertEquals("08", HexString.getHexString(new byte[]{(byte) 8})); Assert.assertEquals("09", HexString.getHexString(new byte[]{(byte) 9})); Assert.assertEquals("0a", HexString.getHexString(new byte[]{(byte) 10})); Assert.assertEquals("0b", HexString.getHexString(new byte[]{(byte) 11})); Assert.assertEquals("0c", HexString.getHexString(new byte[]{(byte) 12})); Assert.assertEquals("0d", HexString.getHexString(new byte[]{(byte) 13})); Assert.assertEquals("0e", HexString.getHexString(new byte[]{(byte) 14})); Assert.assertEquals("0f", HexString.getHexString(new byte[]{(byte) 15})); Assert.assertEquals("10", HexString.getHexString(new byte[]{(byte) 16})); Assert.assertEquals("0000", HexString.getHexString(new byte[]{(byte) 0, (byte) 0})); Assert.assertEquals("0001", HexString.getHexString(new byte[]{(byte) 0, (byte) 1})); Assert.assertEquals("0002", HexString.getHexString(new byte[]{(byte) 0, (byte) 2})); Assert.assertEquals("0003", HexString.getHexString(new byte[]{(byte) 0, (byte) 3})); Assert.assertEquals("0004", HexString.getHexString(new byte[]{(byte) 0, (byte) 4})); Assert.assertEquals("0005", HexString.getHexString(new byte[]{(byte) 0, (byte) 5})); Assert.assertEquals("0006", HexString.getHexString(new byte[]{(byte) 0, (byte) 6})); Assert.assertEquals("0007", HexString.getHexString(new byte[]{(byte) 0, (byte) 7})); Assert.assertEquals("0008", HexString.getHexString(new byte[]{(byte) 0, (byte) 8})); Assert.assertEquals("0009", HexString.getHexString(new byte[]{(byte) 0, (byte) 9})); Assert.assertEquals("000a", HexString.getHexString(new byte[]{(byte) 0, (byte) 10})); Assert.assertEquals("000b", HexString.getHexString(new byte[]{(byte) 0, (byte) 11})); Assert.assertEquals("000c", HexString.getHexString(new byte[]{(byte) 0, (byte) 12})); Assert.assertEquals("000d", HexString.getHexString(new byte[]{(byte) 0, (byte) 13})); Assert.assertEquals("000e", HexString.getHexString(new byte[]{(byte) 0, (byte) 14})); Assert.assertEquals("000f", HexString.getHexString(new byte[]{(byte) 0, (byte) 15})); Assert.assertEquals("0010", HexString.getHexString(new byte[]{(byte) 0, (byte) 16})); Assert.assertEquals("41", HexString.getHexString(new byte[]{(byte) 65})); Assert.assertEquals("4142", HexString.getHexString(new byte[]{(byte) 65, (byte) 66})); }