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.*; public class Main { public static int[] toIntArray(List<Integer> list) { if (isNullOrEmpty(list)) { return null; }/*from ww w. j a va 2s . c o m*/ int[] ints = new int[list.size()]; for (int i = 0; i < ints.length; i++) { ints[i] = list.get(i); } return ints; } public static boolean isNullOrEmpty(Collection c) { return c == null || c.isEmpty(); } public static boolean isNullOrEmpty(String s) { return s == null || s.isEmpty(); } }