title: How would I modify my code to search a multidimensional array diagonally from left to right and right to left?
body: <p>I have this code for searching a multidimensional array from left to right and right to left.</p>
  
  <p>What I need to do now is to search the array from the top left to the bottom right,the top right to the bottom left, the bottom left to the top right, and the bottom right to the top left.</p>
  
  <p>What would I need to change in my existing methods to make a new method to do what I want?</p>
  
  <pre><code>            // Left to Right
              public static String findLeftToRight (char[][]board, String word) {
                  char[] letters = word.toCharArray();
  
                  for (int i = 0; i &lt; board.length; i++){
                      for (int j = 0; j &lt; board[i].length; j++) {
                          boolean found = true;
  
                          for (int k = 0; k &lt; letters.length; k++) {
                              if ((j+k &gt;= board[i].length) || (letters[k] != board[i][j+k])) {
                                  found = false;
                                  break;
                              }
                          }
  
                          if (found) {
                              return "String " + word + " found in row=" + i + " col=" +j;
                          }
                      }
                  }
                  return "String " + word + " not found";
              } // end findLeftToRight
  
              // Right to Left
              public static String findRightToLeft (char[][]board, String word) {
                  char[] letters = word.toCharArray();
  
                  for (int i = board.length-1; i &gt; -1; i--){
                      for (int j = board[i].length-1; j &gt; -1; j--) {
                          boolean found = true;
  
                          for (int k = 0; k &lt; letters.length; k++) {
                              if ((j - k &lt; 0) || (letters[k] != board[i][j-k])) {
                                  found = false;
                                  break;
                              }
                          }
  
                          if (found) {
                              return "String " + word + " found in row=" + i + " col=" +j;
                          }
                      }
                  }
                   return "String " + word + " not found";
              } // end findLeftToRight
  </code></pre>