title: Can somebody point out the error of this code? This is program is a card redrawing program, but for some reason the some cards repeats
body: <pre><code>public class redrawCards {
  
      final int MAX_CARDS = 52;
      int[] number = {1,2,3,4,5,6,7,8,9,10,11,12,13};
      char[] suit = {'D','H','S','C'};            //diamond,heart,spade,club
      String[] card = new String[MAX_CARDS];
  
      public redrawCards(){
          boolean finalize = false;
          for(int i = 0; i &lt; MAX_CARDS; i++) {
              do{
                  StringBuilder temp = new StringBuilder();
                  boolean notFinal = false;
                  int randomSuit = randomNumGenerator(4, 1); //creating random suits
                  int randomNum = randomNumGenerator(13, 1); //creating random numbers
  
                  temp.append(suit[randomSuit - 1]).append(number[randomNum - 1]);
                  card[i] = temp.toString();
  
                  System.out.println(i + ": " + card[i]);
  
                  if(i &gt; 1) {
                      for (int j = 0; j &lt; i; j++) {
                          System.out.println("......" + card[i] + " " + card[j]);
                          if (card[i] == card[j]) {
                              notFinal = true;
                              System.out.println("000000");
                          }
                      }
                  }
                  if(!notFinal){
                      finalize = true;
                  }
              }while (!finalize);
          }
          printAllCards();
      }
  
      private void printAllCards(){ 
          for(int i = 0; i &lt; MAX_CARDS; i++){
              System.out.println(card[i]);
          }
      }
  
      private int randomNumGenerator(int upperBound, int lowerBound){
          return (lowerBound + (int)(Math.random() * ((upperBound - lowerBound) + 1)));
      }
  
      public static void main(String[] args){
          new redrawCards();
      }
  
  }
  </code></pre>