about game of craps homework : <p>this is the first time for my asking a question here.
im new to java and i hava a problem with the loop in this code 
i dont know where to break the loop.</p>

<p>thank you for helping me :)
<a href="https://i.stack.imgur.com/BmWfk.jpg" rel="nofollow noreferrer">this image is from the book regarding this question</a></p>

<pre><code>import java.util.*;


     public class GameOfCraps {



    public static void main(String[] args) {
    Random rn = new Random();
    int counterw = 0;
    int counterl = 0;
    int countsum = counterl + counterw;
    int points = 0;

    do {
        int rndice1 = rn.nextInt(5) + 1; // 1 to 6
        int rndice2 = rn.nextInt(5) + 1;// 1 to 6
        int sum = rndice1 + rndice2;// sum of dice random

        if (sum == 2 || sum == 3 || sum == 12) {
            // System.out.println("you lose");
            counterl++;
        }

        else if (sum == 7 || sum == 11) {
            // System.out.println("you won");
            counterw++;

        }

        else {
            do {
                boolean xc = false;
                points = sum;
                int rndice3 = rn.nextInt(5) + 1;
                int rndice4 = rn.nextInt(5) + 1;

                if (rndice3 + rndice4 == points) {
                    // System.out.println("you won");
                    counterw++;
                    xc = true;
                    //break;
                }

                if (xc == false)
                    counterl++;

            } while (points != 7);

        }

    } while (countsum &lt;= 10000);
    System.out.println(counterw);
    System.out.println(counterl);
    System.out.println("probability of winning the game: "+(double)(counterw)/(counterw+counterl));

}
</code></pre>

<p>}</p>
