How to get the counts display only once for each same character?
<p>I have this code which is working fine but the thing is that the result is showing as below.</p>

<pre><code>public static int[] countlist (char[] list){

    int [] counts = new int[list.length];

    for (int k = 0; k &lt; list.length; k++) {

         for (int m = 0; m &lt; list.length; m++) {
            if (list[m] == list[k]){
                counts[m]++;
            }
        }



        System.out.println( "Letter " + list[k] + " = " + counts[k]);
        }
    }
</code></pre>

<p>Output:</p>

<pre><code>Letter T = 1
Letter T = 2
Letter N = 1
Letter T = 3
Letter Z = 1
Letter N = 2
Letter H = 1
Letter H = 2
</code></pre>

<p>How do I have to do to get the output for each letter once?
Thanks alot 
For example, I want output to be like below</p>

<pre><code>Letter T = 3
Letter N = 2
Letter Z = 1
Letter H = 2
</code></pre>
