int dealerTotal = newCard[2] + newCard[3];if (dealerTotal > 21){ System.out.println();System.out.println("Dealers total is " + dealerTotal + ".");System.out.println("Dealer busts and you win");System.exit(0);}if (dealerTotal == 21){ System.out.println();System.out.println("Dealer shows second card: " + newCard[3] + ".");System.out.println("Dealers total is " + dealerTotal + ".");
System.out.println();System.out.println("Dealer has BlackJack. you lost");System.exit(0);}System.out.println("dealer total is hidden.");System.out.println();// would the player like to hit or staySystem.out.print("do you want to \"hit\" or \"stay\"? ");String hitStay = in.next();System.out.println();int cc = 4; if (hitStay.equalsIgnoreCase("hit")){while (playerTotal < 21 && hitStay.equalsIgnoreCase("hit")){if (hitStay.equalsIgnoreCase("hit")){System.out.println("You drew a " + newCard[cc] + ".");playerTotal = playerTotal + newCard[cc];System.out.println("Your total is " + playerTotal + ".");System.out.println();cc++; //Adds 1 to ensure next card is different.// Bust & Blackjack check.if (playerTotal > 21){System.out.println("You are bust, You lose.");System.exit(0);}if (playerTotal == 21){System.out.println("Blackjack, you win.");System.exit(0);}System.out.print("Would you like to \"hit\" or \"stay\"? ");hitStay = in.next();System.out.println();}} }// Dealers turn, only if Round 1 didn't end in bust/blackjack.in.close();System.out.println("Ok dealers turn.");System.out.println("His hidden card was a " + newCard[3] + "."); // reveal hidden from round one.