does anyone know a faster way to convert string to int array?
Java V7
The format given is "4 343 234 -24
" and so on. Spaces between the numbers, amount of numbers is known beforhand just as is the range within the numbers are
long[] array = new long[length];
for (int i = 0; i < length - 1; i++) {
array[i] = Integer.parseInt(n.substring(0, n.indexOf(' ')));
n = n.substring(n.substring(0, n.indexOf(' ')).length() + 1);
}
array[length - 1] = Integer.parseInt(n);