Dear fellow Java developers:

I'm having a problem involving arrays in Java that I need help with. I a method:

public void removeEven(int [] numbers) {}

the numbers array looks like this:

[23,-32,5,23,43,-32,5,23,23]

I need to write a method so that I iterate through this array, identify the integer that appears an odd number of times (in this case 43), and then print it out. One approach I was thinking of is to create another array, where each index of the second array represents each unique number in the first array. As I iterate through the first array, every time I come across a duplicate number, I increment the index in the second array. Then I would iterate through the second array, and identify the odd number(s) that are in the array. My problem with this is that I'm not sure how really to implement it, nor do I think it is the best approach. Can anyone figure out a solution to this?

Thanks in advance to all who reply.

I suggest to make a HashMap <Integer, Integer>

then you go through array and you populate this HashMap - if you enconter

the number first time you

put(encountered number, 0)

if number ios alreadty there

then

retrieve the number increment it and put again with the asame

key

then you iterate throu your hashmap

and find lll keys which correspond to odd values

Let me know if you have queastions