### Question:
ImmutableHexWritable extends ImmutableBytesWritable { @Override public String toString() { final byte[] bytes = copyBytes(); return new String(MyHex.encode(bytes)); } ImmutableHexWritable();  ImmutableHexWritable(byte[] bytes);  ImmutableHexWritable(final ImmutableBytesWritable ibw);  ImmutableHexWritable(final byte[] bytes, final int offset, final int length); @Override String toString();  }### Answer:
@Test public void toStringTest() throws Exception { final Hex hex = new Hex(); final String str = "DEADBEEF"; final ImmutableHexWritable ihw = new ImmutableHexWritable(hex.decode(str.getBytes())); assertEquals(str, ihw.toString().toUpperCase()); }
@Test public void toStringOffsetTest() throws Exception { final byte[] bytes = { (byte) 0x00, (byte) 0xDE, (byte) 0xAD, (byte) 0xBE, (byte) 0xEF, (byte) 0x00 }; final ImmutableHexWritable ihw = new ImmutableHexWritable(bytes, 1, 4); assertEquals("DEADBEEF", ihw.toString().toUpperCase()); }