title: How to get Hashmap Key and convert it other datatype
body: <p>Hi I am having an error running this code</p>
  
  <pre><code>Map&lt;String, Integer&gt; map = new TreeMap&lt;String, Integer&gt;();//Already populated
  public ArrayList&lt;Map&lt;String, Integer&gt;&gt; storage(){
      for (String getCharacter : map.keySet()){
          String convertBinGrp;
          **Integer binGroups = Integer.valueOf(getCharacter);**
  
          if ( binGroups&gt;=0 &amp;&amp; binGroups&lt;= 32){
              convertBinGrp = Long.toString(binGroups);
              binInsideList.get(convertBinGrp);
              Integer getVal = getCharacter.getValue();
              binInsideList.put(convertBinGrp, getVal);
          }
      }
  </code></pre>
  
  <p>error message: Exception in thread "main" java.lang.NumberFormatException: For input string: " "
  <br>The error indicated is the <strong>Integer binGroups = Integer . valueof(getCharacter)</strong> casting.
  I've already tried using long and double just to make sure its size is bigger because I understand its a String value taken from Map. But is there any other way to solve this? I wanted to convert the String into a numerical value so that I can put it into proper bins or groups. Thanks</p>