title: How can I convert int[] to Integer[] in Java?
body: <p>I'm new to Java and very confused.</p>
  <p>I have a large dataset of length 4 <code>int[]</code> and I want to count the number of times that each particular combination of 4 integers occurs.  This is very similar to counting word frequencies in a document.</p>
  <p>I want to create a <code>Map&lt;int[], double&gt;</code> that maps each int[] to a running count as the list is iterated over, but Map doesn't take primitive types.</p>
  <p>So I made <code>Map&lt;Integer[], Double&gt;</code>.</p>
  <p>My data is stored as an <code>ArrayList&lt;int[]&gt;</code>, so my loop should be something like:</p>
  <pre><code>ArrayList&lt;int[]&gt; data = ... // load a dataset`
  
  Map&lt;Integer[], Double&gt; frequencies = new HashMap&lt;Integer[], Double&gt;();
  
  for(int[] q : data) {
  
      // **DO SOMETHING TO convert q from int[] to Integer[] so I can put it in the map
  
      if(frequencies.containsKey(q)) {
      frequencies.put(q, tfs.get(q) + p);
      } else {
          frequencies.put(q, p);
      }
  }
  </code></pre>
  <p>I'm not sure what code I need at the comment to make this work to convert an <code>int[]</code> to an <code>Integer[]</code>.  Or maybe I'm fundamentally confused about the right way to do this.</p>