Here you can find the source of toIntArray(final Collection
public static int[] toIntArray(final Collection<Integer> collection)
//package com.java2s; import java.util.*; public class Main { public static int[] toIntArray(final Collection<Integer> collection) { final int[] array = new int[collection.size()]; int i = 0; for (Integer integer : collection) array[i++] = integer;/*from w w w. ja va2 s . c o m*/ return array; } }