Here you can find the source of slice(byte[] source, int start, int end)
public static byte[] slice(byte[] source, int start, int end)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] slice(byte[] source, int start, int end) { if (start < 0 || end > source.length) { throw new IllegalArgumentException("start or end is out of bound"); }//from w w w . j a v a 2 s . c o m byte[] target = new byte[end - start]; System.arraycopy(source, start, target, 0, target.length); return target; } }