BytesWritable extends BinaryComparable implements WritableComparable<BinaryComparable> { @Override public String toString() { return IntStream.range(0, size) .mapToObj(idx -> String.format("%02x", bytes[idx])) .collect(Collectors.joining(" ")); } BytesWritable();  BytesWritable(byte[] bytes);  BytesWritable(byte[] bytes, int length); byte[] copyBytes(); @Override byte[] getBytes(); @Deprecated byte[] get(); @Override int getLength(); @Deprecated int getSize(); void setSize(int size); int getCapacity(); void setCapacity(final int capacity); void set(BytesWritable newData); void set(byte[] newData, int offset, int length); @Override void readFields(DataInput in); @Override void write(DataOutput out); @Override boolean equals(Object right_obj); @Override int hashCode(); @Override String toString();  }
@Test public void testToString() { checkToString(new byte[]{0,1,2,0x10}, "00 01 02 10"); checkToString(new byte[]{-0x80, -0x7f, -0x1, -0x2, 1, 0}, "80 81 ff fe 01 00"); }