The goal is to have it count the number of "xx" in the given string. We'll say that overlapping is allowed, so "xxx" contains 2 "xx".
See http://codingbat.com/prob/p194667 I can't seem to figure out why its not working
    int countXX(String str) {
        int f = 0;
        for (int i = 0; i < str.length(); i++){
            if (!str.substring(i+1).isEmpty()){
                if (str.substring(i) == "x" && str.substring (i+1) == "x") {
                    f++;
                }
            }
        }
        return f;  
    }
 
     
     
     
     
     
     
    