Print amount of duplicates of each value in int array java : <p>I'm new to java and has to finish this assignment. The question is, how can I from an array count all duplicates in a method and list them as so:</p>

<pre><code>int [] arr = new int[] {2,5,6,1,2,1,5,3,6,1,2,1,5};
Arrays.sort(arr);
</code></pre>

<p>The values has to be sorted by integer and listed like this:</p>

<ul>
<li>1 - 4</li>
<li>2 - 3</li>
<li>3 - 1</li>
<li>5 - 3</li>
<li>6 - 2</li>
</ul>

<p>hope it makes sence.</p>
