public static int putByteBuffer(byte[] bytes, int offset, ByteBuffer buf) {
    int len = buf.remaining();
    buf.get(bytes, offset, len);
    return offset + len;
  }
Add the whole content of the ByteBuffer to the bytes arrays. The ByteBuffer is modified.
@param bytes  the byte array
@param offset position in the array
@param buf    ByteBuffer to write out
@return incremented offset
hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java