Here you can find the source of getNFirstBytes(int n, List
public static byte[] getNFirstBytes(int n, List<Byte> byteList)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static byte[] getNFirstBytes(int n, List<Byte> byteList) { List<Byte> nFirstByteList = byteList.subList(0, n); byte[] nFirstBytes = new byte[n]; for (int i = 0; i < nFirstByteList.size(); i++) { nFirstBytes[i] = nFirstByteList.get(i); }/* w w w. j a v a 2s . c om*/ return nFirstBytes; } }