Java tutorial
//package com.java2s; public class Main { public static byte[] combBytes(byte[]... bytes) { int length = 0; for (int i = 0; i < bytes.length; i++) { length = length + (bytes[i] != null ? bytes[i].length : 0); } byte[] combBytes = new byte[length]; int position = 0; for (int i = 0; i < bytes.length; i++) { System.arraycopy(bytes[i], 0, combBytes, position, bytes[i].length); position = position + bytes[i].length; } return combBytes; } }