title: Arrays problems in Java
body: <p>I'm trying to write some code that gets matrix 9X9 and two numbers: row- represents number of a row and col- represents number of a column. Zone is little matrix 3X3. the big matrix contains 9 little matrices of 3X3. the method is boolean: and it is outputs true if there are no equal numbers in the cells of little matrix 3X3 that will be located by the row and col numbers. ( the numbers can be from 1 'till 9).</p>
  
  <p>I'm using a boolean array, and take advantage of its index, whenever I meet a number, I update his index-cell in the boolean array, and if I meet true twice I retuen False.
  There can be a situation when the cell is empty, whenever it happens the cell contains the value "-1".
  The code the compiles but does not do the work.  As you can see, I'm searching for the bounds with mod 3.</p>
  
  <p>Can someone recognize a bug?</p>
  
  <pre><code>public static boolean isZoneValid(int row, int col, int[][] matrix) {
      int fromrow = row - (row % 3);
      int fromcol = col - (col % 3);
      boolean[] ind = new boolean[9];
      Arrays.fill(ind, false);
      for (int i = fromrow; i &lt; fromrow + 3; i++) {
          for (int j = fromcol; j &lt; fromcol + 3; j++) {
              if (matrix[i][j] != -1) {
                  if (ind[(matrix[i][j])-1] == true) {
                      return false;
                  } else {
                      ind[(matrix[i][j]) - 1] = true;
                  }
  
              }
          }
  
      }
      return true;
  }
  </code></pre>