Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { /** Convert a Collection of Bytes to a primitive array byte[]. */ public static byte[] unboxBytes(Collection<Byte> coll) { byte[] res = new byte[coll.size()]; int i = 0; for (Byte elem : coll) res[i++] = elem; return res; } }