public static int putBigDecimal(byte[] bytes, int offset, BigDecimal val) {
    if (bytes == null) {
      return offset;
    }

    byte[] valueBytes = val.unscaledValue().toByteArray();
    byte[] result = new byte[valueBytes.length + SIZEOF_INT];
    offset = putInt(result, offset, val.scale());
    return putBytes(result, offset, valueBytes, 0, valueBytes.length);
  }
Put a BigDecimal value out to the specified byte array position.
@param bytes  the byte array
@param offset position in the array
@param val    BigDecimal to write out
@return incremented offset
hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java