Here you can find the source of shorten(byte[] array, int length)
public static byte[] shorten(byte[] array, int length)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] shorten(byte[] array, int length) { if (length == array.length) { return array; }//ww w . j a v a 2s . c o m byte[] result = new byte[length]; System.arraycopy(array, 0, result, 0, length); return result; } }