Here you can find the source of toObject(int[] array)
Parameter | Description |
---|---|
array | the input array, not null |
public static Integer[] toObject(int[] array)
//package com.java2s; /**// w w w .j a v a2 s . c o m * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ public class Main { /** * An empty array. */ public static final Integer[] EMPTY_INTEGER_OBJECT_ARRAY = new Integer[0]; /** * An empty array. */ public static final Long[] EMPTY_LONG_OBJECT_ARRAY = new Long[0]; /** * An empty array. */ public static final Double[] EMPTY_DOUBLE_OBJECT_ARRAY = new Double[0]; /** * Converts a {@code int} array to a {@code Integer} array. * * @param array the input array, not null * @return the output array, not null */ public static Integer[] toObject(int[] array) { if (array.length == 0) { return EMPTY_INTEGER_OBJECT_ARRAY; } Integer[] result = new Integer[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i]; } return result; } /** * Converts a {@code long} array to a {@code Long} array. * * @param array the input array, not null * @return the output array, not null */ public static Long[] toObject(long[] array) { if (array.length == 0) { return EMPTY_LONG_OBJECT_ARRAY; } Long[] result = new Long[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i]; } return result; } /** * Converts a {@code double} array to a {@code Double} array. * * @param array the input array, not null * @return the output array, not null */ public static Double[] toObject(double[] array) { if (array.length == 0) { return EMPTY_DOUBLE_OBJECT_ARRAY; } Double[] result = new Double[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i]; } return result; } }