Here you can find the source of toIntArray(Collection coll)
public static int[] toIntArray(Collection coll)
//package com.java2s; /*/*from www . j a v a 2 s. com*/ * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ import java.util.Collection; import java.util.Iterator; public class Main { public static int[] toIntArray(Collection coll) { Iterator iter = coll.iterator(); int[] arr = new int[coll.size()]; int i = 0; while (iter.hasNext()) { arr[i++] = (Integer) iter.next(); } return arr; } }