title: Snakes and Ladders: Displaying grid in dialog box
body: <p>I am coding a Snakes and Ladders game and I have most of the logic sorted out, except for the method displaying the grid in a message dialog.</p>
  
  <pre><code>private static void generateGrid() {
  
      String[][] board = new String[][] {
          { "48", "47", "46", "45", "44", "43", "42" },
          { "35", "36", "37", "38", "39", "40", "41" },
          { "34", "33", "32", "31", "30", "29", "28" },
          { "21", "22", "23", "24", "25", "26", "27" },
          { "20", "19", "18", "17", "16", "15", "14" },
          { "7", "8", "9", "10", "11", "12", "13" },
          { "6", "5", "4", "3", "2", "1", "0" } };
  
      String grid = "";
  
      for (int x = 0; x &lt; 7; x++) { // This counts the number of
                                                  // rows
  
          for (int y = 0; y &lt; 7; y++) { // This counts the number
                                                      // of columns
  
              if ((board[x][y] + "").length() == 1) {
  
                  grid = grid + board[x][y] + "   \t";
  
              } else {
  
                  grid = grid + board[x][y] + "   \t";
  
              }
  
              grid = grid + "\n";
          }
  
          JOptionPane.showMessageDialog(null, grid);      
  
      }
  }
  </code></pre>
  
  <p>I want the grid displayed in the message dialog to have the same layout as in the array, but when I run my program, this is the end result:</p>
  
  <p><img src="https://i.stack.imgur.com/FF4Zi.png" alt="this is the end result" title="this is the end result"></p>
  
  <p>How do I get it so that when the grid is displayed, the order of the numbers follows the layout shown in the array?</p>