### Question:
BigDecimalAccessor implements PropertyAccessor<BigDecimal> { @Override public byte[] toBytes(Object object) { if (object == null) { return null; } BigDecimal b = (BigDecimal) object; final int scale = b.scale(); final BigInteger unscaled = b.unscaledValue(); final byte[] value = unscaled.toByteArray(); final byte[] bytes = new byte[value.length + 4]; bytes[0] = (byte) (scale >>> 24); bytes[1] = (byte) (scale >>> 16); bytes[2] = (byte) (scale >>> 8); bytes[3] = (byte) (scale >>> 0); System.arraycopy(value, 0, bytes, 4, value.length); return bytes; }  @Override BigDecimal fromBytes(Class targetClass, byte[] bytes); @Override byte[] toBytes(Object object); @Override String toString(Object object); @Override BigDecimal fromString(Class targetClass, String s); @Override BigDecimal getCopy(Object object); BigDecimal getInstance(Class<?> clazz);  }### Answer:
@Test public void testToBytes() { Assert.assertNull(accessor.toString(null)); BigDecimal v1 = new BigDecimal(1111111111); byte[] b = accessor.toBytes(v1); BigDecimal v2 = accessor.fromBytes(BigDecimal.class, b); Assert.assertEquals(v1, v2); }