title: What do I use to keep track of a number?
body: <pre><code>import java.util.Random;
  import java.util.Scanner;
  
  public class dieClass
  {
      public static void main(String []args)
      {
          Random gen = new Random();
          Scanner reader = new Scanner(System.in);
  
  
          System.out.println("How many times do you want to roll?");
          int rollamt = reader.nextInt();
  
  
  
          for (int i = 0; i &lt; rollamt; i++)
          {
              int dice1 = gen.nextInt(6) + 1;
              int dice2 = gen.nextInt(6) + 1; 
              int total = dice1 + dice2;
              int [] arrayDice = new int [rollamt];
  
              for (int r = 0; r &lt; arrayDice.length; r++)
              {
                  arrayDice[r] = total;
              }
  
            System.out.println("sum is " + total);
          }
      }
  }
  </code></pre>
  
  <p>I was on to something but I give up. How do i keep track of how many times the sum of the two die was chosen?
  A while loop ? (The result of the two die can only be between 2 and 12)</p>
  
  <p>So for example I want to have a loop that will Add one  to its counter for its  assigned number</p>
  
  <p>x = sum of two die </p>
  
  <p>y = number of times</p>
  
  <p>The output can be "the number x was rolled y times"</p>