Here you can find the source of byteMerge(byte[][] inp)
public static final byte[] byteMerge(byte[][] inp)
//package com.java2s; public class Main { public static final byte[] byteMerge(byte[][] inp) { int length = 0; if (inp == null) return null; for (int inx = 0; inx < inp.length; inx++) { if (inp[inx] == null) return null; length += inp[inx].length;//from w w w . j a va2 s . co m } int position = 0; byte[] merge = new byte[length]; for (int inx = 0; inx < inp.length; inx++) { for (int jnx = 0; jnx < inp[inx].length; jnx++) { merge[position++] = inp[inx][jnx]; } } return merge; } }