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 int[] asIntArray(Collection<Integer> collection) { int[] array = new int[collection.size()]; Iterator<Integer> iterator = collection.iterator(); int i = 0; while (iterator.hasNext()) { array[i++] = iterator.next(); } return array; } }