Here you can find the source of convertToArray(List
public static int[] convertToArray(List<Integer> list)
//package com.java2s; /*/* w w w. j a v a2 s .c o m*/ * Copyright (c) 2010, James Hanlon * All rights reserved. * * Made available under the BSD license - see the LICENSE file */ import java.util.Iterator; import java.util.List; public class Main { public static int[] convertToArray(List<Integer> list) { int[] array = new int[list.size()]; Iterator<Integer> iterator = list.iterator(); for (int i = 0; i < array.length; i++) array[i] = iterator.next().intValue(); return array; } }