Some psuedo...
1) read the array and have method available for searching the array
a) if a number matches any other number
- mark it for non-printable
- increase the counter
2) Output the printable number and the counter
I suspect there are quite a few classes you may be able to use for your operations if the specifications of your program are not limited to just a regular array. ArrayList comes to mind.