title: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 in map
body: <p>I have the next problem to compile using NetBeans and console in Ubuntu 14.04:</p>
  
  <pre><code>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
  </code></pre>
  
  <p>My code is (in the line of error):</p>
  
  <pre><code>Object maxFreK = map.keySet().toArray()[0];
  </code></pre>
  
  <p>How can I solve it?</p>
  
  <p>Thanks!</p>