How To Count Duplicates In Java