Kill 2 birds with one stone: Give the person running the program the ability to exit before any hands are dealt, in case they do not wish to play. You already have the structure in place.
while(1) {
System.out.println("Welcome to ... How many players are playing (1-24) or enter 0 to exit?");
x = Integer.valueOf(playerx).intValue();
if(x == 0 || x >= 24) {
break;
}
// rest of your logic remains.....
}