Boolean operator in if-statement acting funky
<p>I've been sitting here trying to wrap my head around how this code runs.  I understand (or thought I understood) how boolean operators work in if-statements, but apparently I don't.  The code is:</p>

<pre><code>public class Exercise_6_24 {
  public static void main(String[] args) {
        final int NUMBER_OF_CARDS = 52;
        String[] suits = {"Clubs", "Diamonds", "Hearts", "Spades"};
        String[] ranks = {"Ace", "2", "3", "4", "5", "6", "7", "8", "9",
          "10", "Jack", "Queen", "King"};
        // found indicates whether a suit has been picked
        boolean[] found = new boolean[4]; 

        // Count the number of picks
        int numberOfPicks = 0;

        // Count occurrence in each suit
        int count = 0;
        while (count &lt; 4) {
          numberOfPicks++;
          int index = (int)(Math.random() * NUMBER_OF_CARDS);
          if (!found[index / 13]) {
            found[index / 13] = true;
            count++;

            String suit = suits[index / 13];
            String rank = ranks[index % 13];
            System.out.println(rank + " of " + suit);
          }
        }

        System.out.println("Number of picks: " + numberOfPicks);
      }
}
</code></pre>

<p>It's basically one of those card picking problems.  The part where I'm getting confused is the first if-statement in the while loop.  Prior to the loop, all the slots in the found boolean array is set to false.  Yet, the if-statement in the while loop is testing if the found boolean array is set to true, and if it is true, run the code in the if-statement.  It shouldn't run, but it does.  When I set a breakpoint there, I saw that the boolean array slot changes from false to true to make the code inside the if-statement run.</p>

<p>I seriously do not understand how this is happening.  Can someone explain to me how this is happening?</p>

<p>Thank you!</p>
