Why is Collections.frequency not working as expected on converted list?
<p>I have used Collections.frequency in the past and its worked fine but I'm having problems now that I'm using an int[].</p>

<p>Basically Collections.frequency requires a array but my data is in the form of a int[] so I convert my list but am not getting an results. I think my mistake is in the converting of the list but not sure how to do it.</p>

<p>Here's an example of my problem:</p>

<pre><code>import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;

public class stackexample {
    public static void main(String[] args) {
        int[] data = new int[] { 5,0, 0, 1};
        int occurrences = Collections.frequency(Arrays.asList(data), 0);
        System.out.println("occurrences of zero is " + occurrences); //shows 0 but answer should be 2
    }
}
</code></pre>

<p>I don't get an error just zero but I get weird data when I try to list the items in <code>Arrays.asList(data)</code>, if I just add data directly, it wants to convert my list into <code>collections&lt;?&gt;</code></p>

<p>Any suggestions?</p>
