I'm trying to create a BlackJack game in java.(Ready to Program IDE) How do I turn an 11 into a 1 like I'm trying to do below? : <p>This is my entire code. I can't seem to find a way to pick out the aces and turn them into 1s if the total goes over 21.
    /*********************************************************************************************************************************************************************</p>

<pre><code>Name:
BlackJack_Mason_Haddock

Description:
The famous known game "BlackJack" created in Java.

History:
Nov 16 2016 / M. Haddock / Created: Code skeleton
Nov 17 2016 / M. Haddock / Created: Random number generator from 1 to 10



*********************************************************************************************************************************************************************/
import java.awt.*;              // Used in graphics
import java.awt.event.*;        // For mouse stuff
import java.applet.*;           // For mouse/music stuff
import java.io.*;               // For input and output
import java.util.*;             // For date and time stuff
import java.lang.*;             // For point stuff

import hsa.Console;             // Special console input output commands



class BlackJack_Mason_Haddock
{
    public static void Title (Console c)
    {

    }


    public static void Game (Console c)
    {
        int givenNumber[] = new int [52];   // Makes an empty array of integers of 52. Used for 52 cards in the deck
        int i;                              // Used for any for loops of drawing cards
        int total = 0;                      // Sets a base number for the total number of card scores
        char next;                          // Used to catch the first letter of the string "string"
        String string;                      // Used for a string given by the user
        int ace = 11;                       // Setting aces to 11
        int ace2 = 1;                       // Setting aces to 1 if 11 is over 21


        for (i = 0 ; i &lt; 1 ; i++)  // Runs through the code below twice, once at a time.
        {
            givenNumber [i] = (int) (Math.random () * (11 - 1)) + 1;    // Picks a random number from 1 to 10
            c.print (givenNumber [i] + " ");                            // Outputs the random number picked above, adds a space for the second number
            total = total + givenNumber [i];

            if ((total &lt; 22) &amp;&amp; (givenNumber [i] == 1))
            {
                givenNumber [i] = ace;
                total = total + 10;

            }

            if ((total &gt; 21) &amp;&amp; (givenNumber [i] == ace))
            {
                givenNumber [i] = ace2;
            }

            givenNumber [i] = (int) (Math.random () * (11 - 1)) + 1;    // Picks a random number from 1 to 10
            c.print (givenNumber [i] + " ");                            // Outputs the random number picked above, adds a space for the second number
            total = total + givenNumber [i];
            for (i = 0 ; i &lt; 51 ; i++)
            {
                if ((total &lt; 22) &amp;&amp; (givenNumber [i] == 1))
                {
                    givenNumber [i] = ace;
                    total = total + 10;

                }
            }
            for (i = 0 ; i &lt; 51 ; i++)
            {

                if ((total &gt; 21) &amp;&amp; (givenNumber [i] == ace))
                {
                    givenNumber [i] = ace2;
                }
            }
            if (total == 21)

                {
                    c.print ("BlackJack! You Win!");
                    return;
                }


            do
            {

                c.println ("");
                c.print ("Will you hit or stand?");
                c.println ("");

                string = c.readString ();
                next = string.charAt (0);

                c.println ("");


                if ((total &lt; 21) &amp;&amp; (next == 'S') || (next == 's'))
                {
                    c.print ("You stand at " + total);
                    return;
                }
                else if ((total &lt; 21) &amp;&amp; (next == 'H') || (next == 'h'))
                {

                    givenNumber [i] = (int) (Math.random () * (11 - 1)) + 1;
                    c.print (givenNumber [i] + " ");
                    for (i = 0 ; i &lt; 51 ; i++)
                    {
                        if ((total &gt; 22) &amp;&amp; (givenNumber [i] == 11))
                        {
                            total = total - 10;

                        }

                    }
                    total = total + givenNumber [i];
                    c.println ("");
                    c.print ("Total " + total + " ");

                    if (total == 21)
                    {
                        c.print ("You Win!");
                        return;

                    }
                    if (total &gt; 21)
                    {
                        c.println ("");
                        c.print ("You bust!");
                        return;
                    }
                } //End of the if statement
            } //End of the for statement

            while (true);

        }

    }



    public static void main (String[] args)
    {
        Console c = new Console (32, 167, "BlackJack");
        Title (c);
        Game (c);
    }
}
</code></pre>
