title: I'm just having hard time understanding the class material from my java class
body: <p>Can someone explain this code line by line. I just started to learn how to code and I'm learning java right now,but I'm having hard time how this function executes. What does <code>new int[10]</code>; really do?  and I don't really get the difference or how <code>repeatedDigits[index]</code> part is used differently from the <code>repeatedDigits[remainder]</code> part. </p>
  
  <p>Write a function that counts the repeated digits in the integer x.</p>
  
  <p><strong>For * example</strong>: if <code>x</code> is 999, then your function must print back that <code>9 occurs 3 * times</code>. Another example, if the integer x is 992121, then your function * must print back that <code>9 occurs 2 times, 2 occurs 2 times and 1 occurs 2 * times</code>. This was a guideline for the function. </p>
  
  <pre><code>public static void countRepeatedDigitsInANumber(int x) {
  
  int[] repeatedDigits = new int[10];
  while (x &gt; 0) {
  int remainder = x % 10;
  x = x / 10;
  repeatedDigits[remainder] = repeatedDigits[remainder] + 1;
  
  }
  
  int index = 0;
  while (index &lt; 10) {
  
  if (repeatedDigits[index] != 0)
      System.out.println("The digit " + index + " occurs " + 
      repeatedDigits[index]);
  index++;
  
      }
  }
  </code></pre>
  
  <p>This is a code that compiles. I'm just posting this because I'm having hard time to understand. I would realy appreciate if someone could give any suggestion to learn java quickly as well! </p>