Java Integer Create toIntArray(final String[] arrayOfIntStrings)

Here you can find the source of toIntArray(final String[] arrayOfIntStrings)

Description

Takes an array of Strings and will convert it to an array of ints The Strings MUST be string representations of numbers, otherwise the behavior will be undefined

License

Open Source License

Parameter

Parameter Description
arrayOfIntStrings a parameter

Return

an array of ints

Declaration

public static int[] toIntArray(final String[] arrayOfIntStrings) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  w w  w. ja v a2s  .  c  o m
     * Takes an array of Strings and will convert it to an array of ints
     * The Strings MUST be string representations of numbers, otherwise the
     * behavior will be undefined
     * @param arrayOfIntStrings
     * @return an array of ints
     */
    public static int[] toIntArray(final String[] arrayOfIntStrings) {
        int[] result = new int[arrayOfIntStrings.length];
        for (int i = 0; i < arrayOfIntStrings.length; i++) {
            result[i] = Integer.valueOf(arrayOfIntStrings[i]).intValue();
        }
        return result;
    }
}

Related

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