title: Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 10
body: <p>I'm making a minesweeper using a recursive method to open all tiles adjacent to the block "0".</p>
  
  <p>Everything goes well until I get the exception I mentioned in the title. The exception is fired at <code>if(removalList[num1][num2] == 1){return;}</code>, but made sure to set all the initial values in the removal list to zero. (For your reference, <code>1</code> means that the item has already been added to the <code>removalList</code> for later removal). </p>
  
  <p>I also checked to see if it was in bounds by  doing <code>if(num1 &gt; gameWidth || num2 &gt; gameHeight || num1 &lt; 0 || num2 &lt; 0){return;}. (gameHeight and width are both 10)</code>, but for some reason it thinks that it's out of bounds.</p>
  
  <p>Thanks for your help!</p>
  
  <pre><code>private void function(int c5, int r5)
  {
      int num1 = c5;
      int num2 = r5;
  
      if(num1 &gt; gameWidth || num2 &gt; gameHeight || num1 &lt; 0 || num2 &lt; 0)
      {
          return;
      }
      if(removalList[num1][num2] == 1)
      {
          return;
      }
      if(blocks[num1][num2] == 0)
      {       
          System.out.println("Added (" + num1 + ", " + num2 + ") to removal list.");
          removalList[num1][num2] = 1;
  
          function(num1-1, num2);
          function(num1, num2-1);
          function(num1+1, num2);
          function(num1, num2+1);
  
      }
      else if(blocks[num1][num2] &gt; 0 &amp;&amp; blocks[num1][num2] &lt; 9)
      {
          removalList[num1][num2] = 1;
          return;
      }
      else
      {
          return;
      }
  }
  </code></pre>