title: Find pair number in an Array
body: <p>There is an array consisting several numbers. Among them find out the pair number(that consist 2 times in that array) in java. suppose {2,5,7,8,2,3,5,6,5} in this array 2 consist 2 times so its is pair number.</p>
  
  <p>i tried this way :</p>
  
  <pre><code>HashMap&lt;Integer, Integer&gt; hmap = new HashMap&lt;&gt;();
    for (int i = 0; i &lt; arr.length; i++)
      {
          Integer c = hmap.get(arr[i]);
          if (hmap.get(arr[i]) == null)
                 hmap.put(arr[i], 1);
          else
            hmap.put(arr[i], ++c);
      }
  </code></pre>