集册 Java实例教程 方法将整数数组集合转换为整数数组集合。

方法将整数数组集合转换为整数数组集合。

欢马劈雪     最近更新时间:2020-01-02 10:19:05

435
方法将整数数组集合转换为整数数组集合。
/** n o w  j a v a  . c o m 提供 **/


//package com.book2s;


public class Main {

    /**

     * Method to convert a Array Collection of Integer to a Array Collection of int.

     * @param integerArray the Array Collection of Integers.

     * @return Array Collection of int.

     */

    public static int[] toPrimitive(Integer[] integerArray) {

        //return org.apache.commons.lang3.ArrayUtils.toPrimitive(integerArray);

        if (integerArray == null)

            return null;

        else if (integerArray.length == 0)

            return new int[0];

        final int[] result = new int[integerArray.length];

        
展开阅读全文