Here you can find the source of combineInsertB2sizeAsByte(byte[] b1, byte[] b2)
public static byte[] combineInsertB2sizeAsByte(byte[] b1, byte[] b2)
//package com.java2s; public class Main { public static byte[] combineInsertB2sizeAsByte(byte[] b1, byte[] b2) { if (b1 == null) throw new NullPointerException(); if (b2 == null) throw new NullPointerException(); byte[] ret = new byte[b1.length + b2.length + 1]; for (int i = 0; i < b1.length; i++) ret[i] = b1[i];/*from w w w . j a va 2s. c o m*/ ret[b1.length] = (byte) b2.length; for (int i = 0; i < b2.length; i++) ret[b1.length + 1 + i] = b2[i]; return ret; } }