Java tutorial
//package com.java2s; /************************************************************************************** * Copyright (C) 2008 EsperTech, Inc. All rights reserved. * * http://esper.codehaus.org * * http://www.espertech.com * * ---------------------------------------------------------------------------------- * * The software in this package is published under the terms of the GPL license * * a copy of which has been included with this distribution in the license.txt file. * **************************************************************************************/ import java.util.*; public class Main { /** * Returns an array of integer values from the set of integer values * @param set to return array for * @return array */ public static int[] intArray(Collection<Integer> set) { if (set == null) { return new int[0]; } int[] result = new int[set.size()]; int index = 0; for (Integer value : set) { result[index++] = value; } return result; } }