title: Convert String into 2D int array
body: <p>I have problem with conversion from String into two dimension int array. <br>
  Let's say I have:</p>
  
  <pre><code>String x = "1,2,3;4,5,6;7,8,9"
  </code></pre>
  
  <p>(In my program it will be String from text area.) and I want to create array <code>n x n</code> </p>
  
  <pre><code>int[3][3] y = {{1,2,3},{4,5,6},{7,8,9}} 
  </code></pre>
  
  <p>(Necessary for next stages.) I try to split the string and create 1 dimensional array, but I don't have any good idea what to do next.</p>
  
  <hr>
  
  <p>As you suggest I try split at first using <code>;</code> then <code>,</code> but my solution isn’t great. It works only when there will be <code>3 x 3</code> table. How to create a loop making String arrays?</p>
  
  <pre><code>public int[][] RunMSTFromTextFile(JTextArea ta)
      {
          String p = ta.getText();
          String[] tp = p.split(";");
  
          String tpA[] = tp[0].split(",");
          String tpB[] = tp[1].split(",");
          String tpC[] = tp[2].split(",");
  
          String tpD[][] = {tpA, tpB, tpC};
  
          int matrix[][] = new int[tpD.length][tpD.length];
  
          for(int i=0;i&lt;tpD.length;i++)
          {
              for(int j=0;j&lt;tpD.length;j++)
              {
                  matrix[i][j] = Integer.parseInt(tpD[i][j]);
              }
          }
          return matrix;
      }
  </code></pre>