title: Finding Mode of a Data Set using HashMap and ArrayList. Can't figure it out
body: <p>So I'm trying to make a set of methods that find the mode of a set of ints given to it (in the form of an array), and return an array holding all of the modes, including the possibility of no modes. I sat down for a while writing these snippets of code and I couldn't get it to work, after extensive debugging. The code isn't in great style but I just want to know if anyone could figure out what is going wrong. By the way, the main() method is just there to test out the method. Here's the code:</p>
  
  <pre><code>public static int[] getMode(int[] numset) {
      Map&lt;Integer, Integer&gt; vals = new HashMap&lt;Integer, Integer&gt;();
      ArrayList&lt;Integer&gt; modes = new ArrayList&lt;Integer&gt;();
      int highCount = 0;
  
      for(int num : numset) {
          if(vals.containsKey(num))
              vals.put(num, vals.get(num) + 1);
          else
              vals.put(num, 0);       
      }
  
      if(allValuesEqual(vals)) return new int[0];
  
      for(int key : vals.keySet()) {
          if(vals.get(key) &gt; highCount) {
              highCount = vals.get(key);
          }
      }
  
      for(int key : vals.keySet()) {
          if(vals.get(key) == highCount)
              modes.add(key);
      }
  
      int[] mode = new int[modes.size()];
      int count = 0;
      for(int num : modes) {
          mode[count] = num;
          count++;
      }
  
  
      return mode;
  }
  
  private static boolean allValuesEqual(Map&lt;Integer,Integer&gt; vmap) {
      ArrayList&lt;Integer&gt; a = new ArrayList&lt;Integer&gt;();
      for(int key : vmap.keySet()) {
          a.add(vmap.get(key));
      }
  
      for(int i = 0, n = a.size(); i &lt; n; i++) {
          if(a.get(i) != a.get(0) &amp;&amp; i != 0)
              return false;
      }
      return true;
  }
  
  public static void main(String[] args) {
      int[] array = {6,10,10};
      System.out.println(getMode(array));
  }
  </code></pre>
  
  <p>The result: <code>[I@677327b6</code>.
  I am utterly stumped. Any ideas?</p>