code: public static byte[] concatenate(byte[]... arrays) {
          // Compute the total size needed.
          int totalLen = 0;
          for (byte[] array : arrays) {
              totalLen += array.length;
          }
          byte[] result = new byte[totalLen];
          
          // Concatenate from left to right.
          int offset = 0;
          for (byte[] array : arrays) {
              for (int inx = 0; inx < array.length; inx++) {
                  result[offset++] = array[inx];
              }
          }
          return result;
      }
docs: Concatenate the contents of all provided byte[] arrays into a single value from
  left to right. The result byte[] will equal the sum of all the individual byte[]
  lengths. The result may be zero-length but it won't be null.
  
  @param  arrays One or more byte[] arrays.
  @return        Single byte[] with all input byte[] arrays concatenated from left
  to right.