Java Utililty Methods String to Int Array

List of utility methods to do String to Int Array

Description

The list of methods to do String to Int Array are organized into topic(s).

Method

int[]convertStringToIntArray(String data)
Produces and int array from a String containing comma-separated values
String[] s = data.split(",");
int[] ints = new int[s.length];
for (int i = 0; i < s.length; i++) {
    try {
        ints[i] = Integer.parseInt(s[i]);
    } catch (NumberFormatException e) {
        throw new IllegalArgumentException(e);
return ints;
int[]convertStringToIntegerArray(String string)
Takes a string and takes each possible number and stores them in an int array
int[] numbers = new int[string.length()];
for (int i = 0; i < string.length(); ++i) {
    String substring = string.substring(i, i + 1);
    if (isValid(substring))
        numbers[i] = Integer.parseInt(substring);
return numbers;