Problem statement : In an array 1-100, many numbers are duplicates, how do you find it?
we can loop over array and put the values in a map to find out duplicate numbers with the number of time they repeat them selves.
int numbers = new int ;
The solution I proposed gives you the freedom of printing you data in several way or store the data in a manner which is most easy to retrieve. ie create a map for each number and save them against the key.