public class RollDiceWithArrays { public static void main(String[] args) { int roll, counter; int test = 0; int[] die = new int[7]; for (counter=1; counter<=1000; counter++){ roll = 1 + (int) (Math.random()*6); System.out.println("Roll #" + counter + " is " + roll); die[roll]++; } // end of for loop System.out.print("\n"); // print out the results for (counter=1; counter<=6; counter++) System.out.println("The computer rolled a " + counter+" "+die[counter]+" times."); System.out.print("\n"); // sum the results to test for (counter=1; counter<=6; counter++) test+=die[counter]; System.out.println("Total number of rolls: " + test); System.exit(0); } }