title: Convert String to int array in Java the fast way
body: <p>does anyone know a <em>faster</em> way to convert string to int array?</p>
  
  <p>Java V7</p>
  
  <p>The format given is "<code>4 343 234 -24</code>" and so on. Spaces between the numbers, amount of numbers is known beforhand just as is the range within the numbers are</p>
  
  <pre><code>long[] array = new long[length];            
  for (int i = 0; i &lt; 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);
  </code></pre>