Java tutorial
//package com.java2s; public class Main { public static byte[] subArray(byte[] byteInput, int offset, int length) { if (offset < 0 || offset + length > byteInput.length) { return null; } byte[] rtArray = new byte[length]; System.arraycopy(byteInput, offset, rtArray, 0, length); return rtArray; } }