Java Object Array Create toObjectArray(int[] array)

Here you can find the source of toObjectArray(int[] array)

Description

to Object Array

License

BSD License

Declaration

public static Integer[] toObjectArray(int[] array) 

Method Source Code

//package com.java2s;
/*L/*  w  w  w .  j av a2  s .  c o m*/
 * Copyright Oracle Inc, SAIC-F.
 *
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.com/cadsr-bulk-loader/LICENSE.txt for details.
 */

public class Main {
    public static Integer[] toObjectArray(int[] array) {
        if (array == null) {
            return null;
        }

        Integer[] data = new Integer[array.length];
        for (int i = 0; i < array.length; i++) {
            data[i] = new Integer(array[i]);
        }

        return data;
    }

    public static Double[] toObjectArray(double[] array) {
        if (array == null) {
            return null;
        }

        Double[] data = new Double[array.length];
        for (int i = 0; i < array.length; i++) {
            data[i] = new Double(array[i]);
        }

        return data;
    }
}

Related

  1. toObjectArray(boolean arr[])
  2. toObjectArray(boolean[] primitiveArray)
  3. toObjectArray(byte[] array)
  4. toObjectArray(char... array)
  5. toObjectArray(int[] array)
  6. toObjectArray(int[] oldArray)
  7. toObjectArray(Object array)
  8. toObjectArray(String[][] originalarray)
  9. toObjectArray(T... t)