Java tutorial
//package com.java2s; public class Main { /** * copy byte array from array. * @param from - the orginal array * @param stratidx - the start index * @param ln - the length of the tagert array. * @return - the slice copied fron the original array */ public static byte[] extractBytesArray(byte[] from, int stratidx, int ln) { byte[] toReturn = new byte[ln]; System.arraycopy(from, stratidx, toReturn, 0, toReturn.length); return toReturn; } }