Java tutorial
//package com.java2s; public class Main { public static byte[] sub(byte[] scanRecord, int beginIndex, int endIndex) { final int length = endIndex - beginIndex; byte[] bytes = new byte[length]; System.arraycopy(scanRecord, beginIndex, bytes, 0, length); return bytes; } }