// Let's replace cards. for (int replace = 0; replace < 2; ++replace) { System.out.printf("Which card to replace? (1-5): "); // need to subtract 1 from user input because array indices are 0-4. // Deal new card into this position. int victim = kbd.nextInt() - 1; c[victim] = d.getNextCard(); for (int i = 0; i < c.length; ++i) for (int j = i+1; j < c.length; ++j) { if (c[i].compareTo(c[j]) < 0) { Card temp = c[i]; c[i] = c[j]; c[j] = temp; } } for (int i = 0; i < 5; ++i) { System.out.printf("Card # %d is %s\n", i+1, c[i]); } System.out.printf("You have: %s\n", h.classify()); }