TreeSet myNumbers = new TreeSet();
Random randGen = new Random();
for (int i = 1; i <= 16; i++) {
// number generation here
int randNum = randGen.nextInt(16
You're only generating one number in the range 1-15. You're then generating subsequent numbers with just nextInt:
if (myNumbers.add(randNum))
break;
else
randNum = randGen.nextInt();
That should be:
if (myNumbers.add(randNum))
break;
else
randNum = randGen.nextInt(16) + 1;
... and fix the initial call to nextInt to remove the "-1". (You don't need the 16 - 1, as explained in Josh's answer.)