public static void copyValueTo(Tag tag, byte[] out, int offset) {
    if (tag.hasArray()) {
      Bytes.putBytes(out, offset, tag.getValueArray(), tag.getValueOffset(), tag.getValueLength());
    } else {
      ByteBufferUtils.copyFromBufferToArray(out, tag.getValueByteBuffer(), tag.getValueOffset(),
        offset, tag.getValueLength());
    }
  }
Copies the tag's value bytes to the given byte array
@param tag    The Tag
@param out    The byte array where to copy the Tag value.
@param offset The offset within 'out' array where to copy the Tag value.
hbase-common/src/main/java/org/apache/hadoop/hbase/Tag.java