Here you can find the source of toIntArray(List
public static int[] toIntArray(List<Integer> list)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { /**/*from w w w . j a va 2 s . co m*/ * Converts a List with Integer objects to a primary type int array */ public static int[] toIntArray(List<Integer> list) { if (list == null) return null; int[] arr = new int[list.size()]; int i = 0; for (Integer v : list) arr[i++] = v; return arr; } }