@Test
public void toHextTest() {

    assertEquals(toHex((byte) 0), "0");
    assertEquals(toHex((byte) 1), "1");
    assertEquals(toHex((byte) 15), "f");
    assertEquals(toHex((byte) 127), "7f");
    assertEquals(toHex((byte) 0xcc), "cc");
    // arrays
    assertEquals(toHex(new byte[]{(byte) 0x01}), "1");
    assertEquals(toHex(new byte[]{(byte) 0xcc}), "cc");
    assertEquals(toHex(new byte[]{0x00, 0x00}), "0");
    assertEquals(toHex(new byte[]{0x01, 0x1f, (byte) 0xcc}), "11fcc");
    assertEquals(toHex(new byte[]{0x01, 0x1f, 0x00}), "11f00");
    assertEquals(toHex(new byte[]{0x00, 0x01, 0x1f, 0x01, 0x00, 0x00}), "11f010000");
}