@Test public void testToString() { final byte[] some = new byte[] {2, 5, 0, 1 }; final String expected = "byte[]{length=" + some.length + ", hash=" + Arrays.hashCode(some) + "}"; assertEquals(expected, String.valueOf(ByteArraySizeHashPrinter.of(some))); assertNotNull(ByteArraySizeHashPrinter.orNull(some)); }
@Override public String toString() { ToStringHelper helper = MoreObjects.toStringHelper("byte[]"); if (bytes != null) { helper.add("length", bytes.length) .add("hash", Arrays.hashCode(bytes)); } else { helper.addValue(bytes); } return helper.toString(); }
ByteArraySizeHashPrinter { @Override public String toString() { ToStringHelper helper = MoreObjects.toStringHelper("byte[]"); if (bytes != null) { helper.add("length", bytes.length) .add("hash", Arrays.hashCode(bytes)); } else { helper.addValue(bytes); } return helper.toString(); } }
ByteArraySizeHashPrinter { @Override public String toString() { ToStringHelper helper = MoreObjects.toStringHelper("byte[]"); if (bytes != null) { helper.add("length", bytes.length) .add("hash", Arrays.hashCode(bytes)); } else { helper.addValue(bytes); } return helper.toString(); } ByteArraySizeHashPrinter(byte[] bytes); }
ByteArraySizeHashPrinter { @Override public String toString() { ToStringHelper helper = MoreObjects.toStringHelper("byte[]"); if (bytes != null) { helper.add("length", bytes.length) .add("hash", Arrays.hashCode(bytes)); } else { helper.addValue(bytes); } return helper.toString(); } ByteArraySizeHashPrinter(byte[] bytes); static ByteArraySizeHashPrinter of(byte[] bytes); static ByteArraySizeHashPrinter orNull(byte[] bytes); @Override String toString(); }
ByteArraySizeHashPrinter { @Override public String toString() { ToStringHelper helper = MoreObjects.toStringHelper("byte[]"); if (bytes != null) { helper.add("length", bytes.length) .add("hash", Arrays.hashCode(bytes)); } else { helper.addValue(bytes); } return helper.toString(); } ByteArraySizeHashPrinter(byte[] bytes); static ByteArraySizeHashPrinter of(byte[] bytes); static ByteArraySizeHashPrinter orNull(byte[] bytes); @Override String toString();  }