public static byte[] add(final byte[][] arrays) {
    int length = 0;
    for (int i = 0; i < arrays.length; i++) {
      length += arrays[i].length;
    }
    byte[] result = new byte[length];
    int index = 0;
    for (int i = 0; i < arrays.length; i++) {
      System.arraycopy(arrays[i], 0, result, index, arrays[i].length);
      index += arrays[i].length;
    }
    return result;
  }
Concatenate byte arrays.
@param arrays all the arrays to concatenate together.
@return New array made from the concatenation of the given arrays.
hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java