import java.util.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		int[] strArray = new int[] {1,1, 2, 3, 2, 2, 3, 4, 7, 5, 4};
		Set<Integer> duplicates = checkDuplicate(strArray);
		System.out.printf("Duplicates: %s\n", duplicates);
	}
	private static Set<Integer> checkDuplicate(int[] intArray)
	{
		Set<Integer> duplicates = new HashSet<Integer>();
		Set<Integer> tmp = new HashSet<Integer>();
		for(Integer i: intArray)
		{
			if(!tmp.add(i))
			{
				duplicates.add(i);
			}
		}
		return duplicates;
	}
}