title: Reading in integers to a 2D array
body: <p>I need help with reading integers into a 2D square array of N x N dimensions.</p>
  
  <p>For example, if the user input is:</p>
  
  <pre><code>123  
  333  
  414
  </code></pre>
  
  <p>Then I will need an array: </p>
  
  <pre><code>{
   {1, 2, 3}, 
   {3, 3, 3}, 
   {4, 1, 4}
  }
  </code></pre>
  
  <p>The problem that I am having is that there is no space between these integers. If there were a space, I could just do</p>
  
  <pre><code>for (int i = 0 ; i &lt; N; i++) {
      for(int j = 0; j &lt; N ; j++) {
          myArray[i][j] = scan.nextInt();
      }
  }
  </code></pre>
  
  <p>I approached this problem by trying to use substrings and parsing it into the array, although I did not get anywhere.</p>
  
  <p><strong>Another approach (Edit)</strong></p>
  
  <pre><code>for (int i = 0; i &lt; N; i++) {
      for (int j = 0; j &lt; N; j++) {
          myArray[i][j] = Integer.parseInt(scan.nextLine().substring(j, j+1));
      }
  }
  </code></pre>
  
  <p>This does not work either - it keeps running after the three lines are entered.</p>