Java Integer Create toIntegerArray(final int[] ints)

Here you can find the source of toIntegerArray(final int[] ints)

Description

Produces an array of Integer objects from an int[].

License

Open Source License

Parameter

Parameter Description
ints the array to be converted

Return

an array of objects

Declaration

public static Integer[] toIntegerArray(final int[] ints) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from   w w  w  .  j ava2 s  . c o m
     * Produces an array of {@link Integer} objects from an <code>int[]</code>.
     * <p>
     * Can be used to produce an array of objects to feed an iterator
     * 
     * @param ints the array to be converted
     * @return an array of {@link Integer} objects
     */
    public static Integer[] toIntegerArray(final int[] ints) {
        final Integer[] result = new Integer[ints.length];
        for (int i = 0; i < ints.length; i++) {
            result[i] = Integer.valueOf(ints[i]);
        }
        return result;
    }
}

Related

  1. toInteger(String[] source)
  2. toInteger(StringBuilder value)
  3. toIntegerArray(byte[] input, int offset, int len)
  4. toIntegerArray(double[] doubles)
  5. toIntegerArray(final int[] array)
  6. toIntegerArray(String text, String delimiter)
  7. toIntegerArray(String... values)
  8. toIntegerByObject(Object obj)
  9. toIntegerFromObj(Object obj)