Here you can find the source of toIntArray(ArrayList
public static int[] toIntArray(ArrayList<Integer> array)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { public static int[] toIntArray(ArrayList<Integer> array) { Integer[] temp = new Integer[array.size()]; int[] out = new int[array.size()]; temp = array.toArray(temp);/*from ww w . jav a 2 s . c o m*/ for (int i = 0; i < array.size(); i++) { out[i] = temp[i]; } return out; } }