### Question:
HexArray implements Serializable { public static String toHex(final byte[] data) { return data != null ? toHex(data, data.length) : null; } HexArray(byte... data); static String toHex(final byte[] data); static String toHex(final byte[] data, final int len); static String toHexShort(final byte[] data, final int maxLen); static byte[] fromHex(String hex); @Override String toString(); byte[] getData(); @Override boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test public void toHex() { assertEquals("0102030405060708090a0b0c", HexArray.toHex(new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12})); assertEquals("0102030405060708090a0b0c", new HexArray(new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}).toString()); assertEquals("01020304..", HexArray.toHexShort(new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, 4)); assertEquals("0102030405", HexArray.toHexShort(new byte[]{1, 2, 3, 4, 5}, 5)); }