title: Using char[] array in HashMap in java
body: <p>I am using a HashMap with a char array as the key. But when I put the key, value into the HashMap and print it the value printed as the key is some strange value. If I use a string instead, it is working fine. Please let me know how to make this work for char[] values.</p>
  
  <pre><code>            while((ch = br.read()) != -1) {
              s = new char[10];
              s[i++] = (char)ch;
  
              while( (i &lt; 10) &amp;&amp; ((ch = br.read()) != -1)) {
                  s[i++] = (char)ch;                  
              }
  
              //System.out.println(s);
              hmap.put(s, 1); 
              //System.out.println(hmap);
              i = 0;              
          }
  </code></pre>
  
  <p>Key: BZOUA1578L
  Value: 1</p>
  
  <p>The contents in the hashmap are {[C@31ff23=1} instead of {BZOUA1578L, 1}</p>