find pairs in int [] b;?
<p>how to find all pairs of numbers chosen from b, 
for example i have </p>

<pre><code>int [] b = {1,2,3,5,4,3,2,1,1};
</code></pre>

<p>and i need to print the pairs found in this integer array and the position they are at
keep in mind that i tried to compare them like this</p>

<pre><code>for (int i = 0; i &lt; ia.length; i++) {
    number = 0;
    for (int j = 0; j &lt; ia.length; j++) {
        if (ia[i] == ia[j]) {
            number++;
        }
    }
    if (number%2==0) {
        System.out.println("found pairs at  ia["+i+"] = "+ia[i] );
    }
}
</code></pre>

<p>but the problem is that it keeps comparing the other numbers so if we have a number that can be found 3 times  the first time it will compare it and will say that it's not a pair but the second time it will not be compared with previous value so instead of 3 it will find 2 and it will say that it's pair </p>

<p>thank you for taking time in responding to my question </p>