title: Read dimensions from text file and then add rest of items into array?
body: <p>Here is how the text file is formatted</p>
  
  <pre><code>8   5
  String1 String2 String3
  </code></pre>
  
  <p>I want the 8 and 5 to be the respective rows and columns and then add the strings into the array so I have</p>
  
  <pre><code>    File f4 = new File(s);
      Scanner in=new Scanner(f4);
  
      int i = 0;
      int rows = 0;
      int columns = 0;
      while (in.hasNextInt())
      {
          rows = in.nextInt();
          columns = in.nextInt();         
      }
  
      String[][] data = new String[rows][columns];
  
      for (int t = 0;i &lt; data.length; i++) {
          for (int j = 0; j&lt;data[i].length; j++)
          {
              data[t][j] = in.next();
          }
      }
      return data;
  </code></pre>
  
  <p>However, data is just filled with null strings and the last row of the text file why?</p>
  
  <p>Here is my printing for loop that results in some nulls and some strings</p>
  
  <pre><code>for (int t = 0; t &lt; data.length; t++)
          {
              for (int q = 0; q &lt; data[t].length; q++)
              {
                  System.out.println(data[t][q]);
              }
          }
  </code></pre>