title: Convert a string of numbers into an array
body: <p>i'm having problems creating a program that converts a string of numbers into an array. </p>
  
  <p>i know there is a similar question on here, but all i have to work with is a set of numbers such as [10 15 16 0 57 438 57 18]</p>
  
  <p>heres what i have so far:</p>
  
  <pre><code>import java.util.Scanner;
  public class Histogram {
  
     public static void main(String[] args) {
       Scanner keyboard = new Scanner(System.in);
       String numbers;
  
  
       numbers = keyboard.next();
       System.out.println(numbers);
  
       int [] n1 = new int [numbers.length()];
  
  
  
       for(int n = 0; n &lt; numbers.length(); n++) {
          n1[n] = Integer.parseInt(numbers.split(" ")[n]);
       }
  
  
  }
  }
  </code></pre>
  
  <p>this code throws throws an exception:</p>
  
  <pre><code>10 15 20 25 30
  10
  Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
  at Histogram.main(Histogram.java:18)
  </code></pre>
  
  <p>what am i doing wrong? i want to avoid using commas to separate the elements. can anyone explain why the exception is being thrown and how to fix it? i want to understand more than anything.</p>