title: Integer.valueOf() Error ArrayIndexOutOfBoundsException:
body: <pre><code>String currentLine = reader.readLine();
  while (currentLine != null)
  {
    String[] studentDetail = currentLine.split("");
  
    String name = studentDetail[0];
  
    int number = Integer.valueOf(studentDetail[1]);
    currentLine = reader.readLine();
  }
  </code></pre>
  
  <p>So I have a file like this:</p>
  
  <pre><code>   student1
     student16
     student6
     student9
     student10
     student15
  </code></pre>
  
  <p>When I run the program said:
  ArrayIndexOutOfBoundsException:1</p>
  
  <p>the output should look like this:</p>
  
  <pre><code>   student1
     student6
     student9
     student10
     student11
     student15
     student16
  </code></pre>