Java Integer Create toIntArray(final Object[] array)

Here you can find the source of toIntArray(final Object[] array)

Description

to Int Array

License

Open Source License

Declaration

public static int[] toIntArray(final Object[] array) 

Method Source Code

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

public class Main {
    public static int[] toIntArray(final Object[] array) {
        if (array == null) {
            return new int[0];
        }/* www.j  av a 2 s . com*/

        final int[] retVal = new int[array.length];

        try {
            for (int i = 0; i < array.length; i++) {
                retVal[i] = Integer.parseInt(String.valueOf(array[i]));
            }

            return retVal;
        } catch (Exception e) {
            return new int[0];
        }
    }
}

Related

  1. toIntArray(double[] array)
  2. toIntArray(final byte[] array)
  3. toIntArray(final byte[] bytes)
  4. toIntArray(final double[] doubleArray)
  5. toIntArray(final int ip)
  6. toIntArray(final String[] arrayOfIntStrings)
  7. toIntArray(int... values)
  8. toIntArray(Integer[] data)
  9. toIntArray(Integer[] objArray)