Dice throwing simulation in Java For one of my labs I need to write a complete java program which will simulate a &quot;very simple&quot; dice betting game. The specifications are as follows: simulate the throw of 3 dice. If you throw three sixes then you win $20; if you throw three of any other value then you win $10; if you throw two dice which are the same value then you win $5. If none of the conditions above are met, then you would lose $1.
Example Runs: Dice Throw
Dice 1 : 2     Dice 2 : 1    Dice 3 : 2
Congratulations : You threw TWO - 2s
You win $5

Dice 1 : 2    Dice 2 : 2    Dice 3 : 2
Congratulations : You threw THREE - 2s
You win $10

Dice 1 : 4    Dice 2 : 6    Dice 3 : 3
Unfortunately : You did not throw anything of value
You lose $1

The resulting code that I wrote to solve this problem is as follows:
/**
 * SRN: 507-147-9
 */
public class Lab6_part3 {

    public static void main(String[] args) {

        // define vars
        int round = 1;
        int dice1, dice2, dice3;

        while (round &lt;= 3) {

            dice1 = 1 + (int)(Math.random() * 6);
            dice2 = 1 + (int)(Math.random() * 6);
            dice3 = 1 + (int)(Math.random() * 6);

            System.out.println();
            System.out.println(&quot;Dice 1 : &quot; + dice1 + &quot;    Dice 2 : &quot; + dice2 + &quot;    Dice 3 : &quot; + dice3);

            // Three of a kind
            if ((dice1 == dice2) &amp;&amp; (dice1 == dice3)) { // 3-of-a-kind (D1)                              

                // Rolls three sixes
                if (dice1 == 6) {
                    System.out.println(&quot;Congratulations : You threw THREE - 6s&quot;);
                    System.out.println(&quot;You win $20&quot;);
                } else {
                    // Rolls three of anything else
                    System.out.println(&quot;Congratulations : You threw THREE - &quot; + dice1 + &quot;s&quot;);
                    System.out.println(&quot;You win $10&quot;);
                }
            }
            
            // Two of a kind (PRINT &quot;dice1&quot;)
            else if (dice1 == dice2 || dice1 == dice3) {
                System.out.println(&quot;Congratulations : You threw TWO - &quot; + dice1 + &quot;s&quot;);
                System.out.println(&quot;You win $5&quot;);
            } 
            
            // Two of a kind (PRINT &quot;dice2&quot;)
            else if (dice2 == dice1 || dice2 == dice3) {                              
                System.out.println(&quot;Congratulations : You threw TWO - &quot; + dice2 + &quot;s&quot;);
                System.out.println(&quot;You win $5&quot;);
            }

            // Two of a kind (PRINT &quot;dice3&quot;)
            else if (dice3 == dice1 || dice3 == dice2) {                              
                System.out.println(&quot;Congratulations : You threw TWO - &quot; + dice3 + &quot;s&quot;);
                System.out.println(&quot;You win $5&quot;);
            } 
            // Did not throw anything of value
            else {
                System.out.println(&quot;Unfortunately : You did not throw anything of value&quot;);
                System.out.println(&quot;You lose $1&quot;);
            }
            round++;
        }
    }
}

The problem that I'm running into with this approach is that although the code functions as it's supposed to, I would like to have a simpler way to write the two-of-a-kind instead of having three &quot;if&quot; statements.
My goal in this, is to create a three-way &quot;or&quot; statement instead of comparing dice1 with dice 2 and 3, and dice 2 with dice 1 and 3, etc...
else if (dice1 == dice2 || dice1 == dice3 || dice2 == dice3) {                              
    System.out.println(&quot;Congratulations : You threw TWO - &quot; + somethings?? + &quot;s&quot;);
    System.out.println(&quot;You win $5&quot;); 

If I were to do that, how would I then be able to print out the value of the pair which I've identified?
Welcome to CodeReview. Regarding your issue, a quick solution is:
else if (dice1 == dice2 || dice1 == dice3 || dice2 == dice3) {       
    int doubleNum = dice1 == dice2 ? dice1 : dice1 == dice3 ? dice1 : dice3;
    System.out.println(&quot;Congratulations : You threw TWO - &quot; + doubleNum + &quot;s&quot;);
    System.out.println(&quot;You win $5&quot;); 
}

The ternary operator makes the code more compact, but in this case I think it's a bit less readable than a chain of if-else.
Few other suggestions:

The while-loop can be replaced by a more convenient for-loop. From:
int round = 1;
while(round&lt;=3){
    //...
    round++;
}

To:
for(int round = 1; round &lt;= 3; round++) {
    //...
}


Declaring multiple variables in one line int dice1, dice2, dice3; is not considered good practice in Java.
Instead of generating a random float and then casting it to an int, generate directly an int with ThreadLocalRandom.current().nextInt(6). Docs.
You can print the first line with System.out.format. From:
System.out.println();
System.out.println(&quot;Dice 1 : &quot; + dice1 + &quot;    Dice 2 : &quot; + dice2 + &quot;    Dice 3 : &quot; + dice3);

To:
System.out.format(&quot;%nDice 1 :  %d    Dice 2 : %d    Dice 3 : %n&quot;, dice1, dice2, dice3)


Class names should be PascalCase. Instead of Lab6_part3 you can name it Lab6Part3.
Declare a constant for the number of rounds, to make it easier to change. For example:
public class Lab6Part3 {

    private static final int ROUNDS = 3;

    public static void main(String[] args) {
        for(int round = 1; round &lt;= ROUNDS; round++) {
            //...
        }
}



Another approach is to generate three numbers with Random#ints and calculate the frequencies:
Random r = new Random();
// Generate three random numbers from 1 to 6
IntStream diceRolls = r.ints(3, 1, 7);

// Generate map of frequencies
Map&lt;Integer, Long&gt; freq = diceRolls.boxed()
        .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));

boolean winner = false;
for (Entry&lt;Integer, Long&gt; entry : freq.entrySet()) {
    int number = entry.getKey();
    long times = entry.getValue();
    if (times == 3) {
        // Three of a kind ...
        winner = true;
    } else if (times == 2) {
        // Two of a kind...
        System.out.println(&quot;Congratulations : You threw TWO - &quot; + number + &quot;s&quot;);
        System.out.println(&quot;You win $5&quot;);
        winner = true;
    }
}
if(!winner) {
    // Did not throw anything of value
}