title: how to add int value to Set<Integer> (HashSet<Integer>)?
body: <p>I created a set and a random number (type of int) that I want to add to my set:</p>
  
  <pre><code>private Set&lt;Integer&gt; mySet = new HashSet&lt;Integer&gt;(numElements); // capacity of 'numElements'
  
  Random r = new Random();
  int rand = r.nextInt(maxVal - minVal + 1) + minVal;
  mySet.add(rand); // error: cannot convert int to Integer
  </code></pre>
  
  <p>so I tried these:</p>
  
  <pre><code>1. mySet.add(rand); // error: no suitable method found for add(int)
  2. mySet.add(Integer.valueOf(rand)); //error: cannot find symbol method valueOf(int)
  3. mySet.add(new Integer(rand)); // error: type parameter Integer cannot be instantiated directly
  </code></pre>
  
  <p>They all don't work so how can I add 'rand' to my set?</p>