Finding duplicate numbers
I have modified your code. The logic is same as you have done. You do not need to create those Integer. Read about Autoboxing. If the input array is large, you will see performance hit for creating Integer. Note that Integer is a class, and not a primitive type in java.

public static void main(String[] args) {                                                                                                                                            
    int[] arr={10,20,10,2,11,10,32,15,15,10,10};                                                                                                                                      
    HashMap&lt;Integer,Integer&gt; result = new HashMap&lt;Integer,Integer&gt;();                                                                                                                 

    for(int element : arr)                                                                                                                                                            
      {                                                                                                                                                                               
        if(result.containsKey(element))                                                                                                                                               
          {                                                                                                                                                                           
            result.put(element, result.get(element) + 1);                                                                                                                             
          }                                                                                                                                                                           
        else                                                                                                                                                                          
          {                                                                                                                                                                           
            result.put(element, 1);                                                                                                                                                   
          }                                                                                                                                                                           
      }                                                                                                                                                                               
    System.out.println(result);                                                                                                                                                       
  }