Here you can find the source of toIntArray(Collection
public static int[] toIntArray(Collection<Integer> list)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static int[] toIntArray(Collection<Integer> list) { int n = list == null ? 0 : list.size(); int[] arr = new int[n]; if (list != null) { int i = 0; for (int d : list) arr[i++] = d;//from www.jav a2 s .c om } return arr; } }