Java tutorial
//package com.java2s; public class Main { public static byte[] encodeData(byte[] headData, byte[] bodyData, byte[] footData) { byte[] data = new byte[headData.length + bodyData.length + footData.length]; System.arraycopy(headData, 0, data, 0, headData.length); System.arraycopy(bodyData, 0, data, headData.length, bodyData.length); System.arraycopy(footData, 0, data, headData.length + bodyData.length, footData.length); return data; } }