Here you can find the source of toPrimitiveIntegerArray(List
public static int[] toPrimitiveIntegerArray(List<Integer> listOfInt)
//package com.java2s; /*//from w w w. j a v a 2 s. c o m * Copyright (c) 2012, 2013 Mateusz Parzonka * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Mateusz Parzonka - initial API and implementation */ import java.util.List; public class Main { public static int[] toPrimitiveIntegerArray(List<Integer> listOfInt) { int[] result = new int[listOfInt.size()]; int i = 0; for (Integer n : listOfInt) { result[i++] = n; } return result; } }