title: Convert a 2d array to a organizing table look
body: <p>I have convert a txt file into a 2d array, how can I make it look more organize?</p>
  
  <p>My input file look like this:</p>
  
  <pre>
  [Name], Exam1, Exam2, Exam3
  John, 99, 88, 89
  May, 99, 100, 100
  Mary, 100, 100, 100
  Peter, 60, 60, 60
  </pre>
  
  <p>Currently I get:</p>
  
  <pre>
  [Name] Exam1 Exam2 Exam3
  John 99 88 89
  May 99 100 100
  Mary 100 100 100
  Peter 60 60 60
  </pre>
  
  <p>I want the data looks more like a table which is easier to read, how can I do that?</p>
  
  <p>Code:</p>
  
  <pre><code>public static void main(String[] args) throws Exception{
      File file = new File("test.txt");
      BufferedReader br = new BufferedReader(new FileReader(file));
      int width = 0, height = 0;
      String line = "";
  
      /*Find number of row and column of the file.*/
      while ((line = br.readLine()) != null)
      {
                  if (width == 0)
                  {
                    /*Find the number of row using split method(",")*/
                      String[] str = line.split(",");
                      width = str.length;
                  }
          height++;
      }
      System.out.println("Row : " + height);
      System.out.println("Column : " + width);
  
      /*Adding values to the 2D Array.*/
      String[][] data = new String[height][width];
      br = new BufferedReader(new FileReader(file));
  
      for (int i = 0; i &lt; height; i++)
      {
          if ((line = br.readLine()) != null)
          {
              for (int j = 0; j &lt; width; j++)
              {                                   
                  String[] str = line.split(",");     
                  data[i][j] = str[j];
  
                  System.out.print( data[i][j] + " ");
              }
  
          }
  
         System.out.println("");
  
      }
  }
  </code></pre>
  
  <p>Thank you very much.</p>