You can iterate over the characters and save the occurence of each character and the one after it in a hashmap as follows:
public static void main(String[] args) {
    String str = "AABBCCAACC";
    System.out.println(getOccurences(str));
}
private static HashMap<String,Integer> getOccurences(String str) {
    HashMap<String,Integer> map = new HashMap<>();
    if(!str.isEmpty() && str.length()>1) {
        char[] characters = str.toCharArray();
        for(int i = 0; i < characters.length-1; i++) {
            String current = ""+characters[i]+characters[i+1];
            if(map.containsKey(current))
                map.replace(current, map.get(current)+1);
            else
                map.put(current,1);
        }
    }
    return map;
}
The output here would be:
{AA=2, BB=1, CC=2, AB=1, BC=1, AC=1, CA=1}