Apple interview question

Count number of repeated characters in a String HashMap<Character, Integer> my_map = new HashMap<Character, Integer>(); char[] str_array = charstring.toCharArray(); for (char abc : str_array){ if (my_map.containsKey(abc)) { my_map.put(abc, my_map.get(abc) + 1); } else{ my_map.put(abc, 1); } }//end of char for for (Map.Entry entry : my_map.entrySet()) { System.out.println(entry.getKey() + " " + entry.getValue()); // print (char "space" Integer) <--comes from the map! } String charstring="rrrttsr