title: What does for(int i : x) do?
body: <p>I am new to Java. I was reading someone's solution to a question and I encountered this:</p>
  
  <pre><code>        int[] ps = new int[N];
          for (int i = 0; i &lt; N; i++)
              ps[i] = input.nextInt();
  
          int[] counts = new int[1005];
          for (int p : ps)
              counts[p]++;
  </code></pre>
  
  <p>What do the last two lines do?</p>