Java tutorial
//package com.java2s; // it under the terms of the GNU Lesser General Public License as published by import java.util.Collection; import java.util.Iterator; public class Main { public static short[] asShortArray(Collection<Short> collection) { short[] array = new short[collection.size()]; Iterator<Short> iterator = collection.iterator(); int i = 0; while (iterator.hasNext()) { array[i++] = iterator.next(); } return array; } }