Here you can find the source of toIntArray(Collection
public static int[] toIntArray(Collection<Integer> collection)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static int[] toIntArray(Collection<Integer> collection) { if (collection == null) throw new RuntimeException( "Can't do toIntArray. Collection is Null"); int[] result = new int[collection.size()]; int i = 0; for (Integer el : collection) result[i++] = el;/*from w ww . ja v a 2 s . c o m*/ return result; } }