Here you can find the source of toIntArray(List
public static int[] toIntArray(List<Integer> list)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static int[] toIntArray(List<Integer> list) { int[] array = new int[list.size()]; for (int i = 0; i < array.length; i++) array[i] = list.get(i);/* w w w . j a va2 s.c om*/ return array; } public static <T> T get(List<T> l, int i) { return get(l, i, null); } public static <T> T get(List<T> l, int i, T defValue) { if (i < 0) i += l.size(); if (i < 0 || i >= l.size()) return defValue; return l.get(i); } public static <T> T get(T[] l, int i) { return get(l, i, null); } public static <T> T get(T[] l, int i, T defValue) { if (i < 0) i += l.length; if (i < 0 || i >= l.length) return defValue; return l[i]; } public static double get(double[] l, int i, double defValue) { if (i < 0) i += l.length; if (i < 0 || i >= l.length) return defValue; return l[i]; } }