Here you can find the source of toIntArray(Collection
private static int[] toIntArray(Collection<Integer> values)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { private static int[] toIntArray(Collection<Integer> values) { int[] result = new int[values.size()]; int i = 0; for (int value : values) result[i++] = value;// w ww. java2s .c o m return result; } }