import java.util.Random; public class Dice { Random random = new Random(); public void startGame() { Integer[] dices1 = fiveRools(); Integer[] dices2 = fiveRools(); printResult("Ember", dices1); printResult("Gép", dices2); } private Integer[] fiveRools() { Integer[] dices = new Integer[5]; dices[0] = diceRoll(); dices[1] = diceRoll(); dices[2] = diceRoll(); dices[3] = diceRoll(); dices[4] = diceRoll(); return dices; } private int diceRoll() { return random.nextInt(6)+1; } private void printResult(String role, Integer[] dices) { System.out.printf("%10s: ", role); for(int dice : dices) { System.out.print(dice); System.out.print(" "); } System.out.println(); } }