Find Character

Find character count in String
Count the number of characters in a text.

Input
String input=”aaaaabbbbcsssssssc”;

Output
{s=7, b=4, c=2, a=5}

Solution
public static Map<Character, Integer> getCharCount(String input) {
Map<Character, Integer> charCountMap = new HashMap<Character, Integer>();
if(null!=input) {
for(char charInput : input.toCharArray()) {
int count = 1;
if(null != charCountMap.get(charInput)) {
count = charCountMap.get(charInput);
charCountMap.put(charInput, ++count);
} else {
charCountMap.put(charInput, count);
}
}
}
return charCountMap;

}