@@ -0,0 +1,737 @@
+package codingbat.warmup2;%0A%0A/*%0A * Count the number of %22xx%22 in the given string. %0A * We'll say that overlapping is allowed, so %22xxx%22 contains 2 %22xx%22. %0A * %0A * countXX(%22abcxx%22) = 1%0A * countXX(%22xxx%22) = 2%0A * countXX(%22xxxx%22) = 3%0A */%0A%0Apublic class CountXXTest %7B%0A%0A  public static void main(String%5B%5D args) %7B%0A%0A    CountXXTest test = new CountXXTest();%0A%0A    System.out.println(%22%3E%22 + test.countXX(%22abcxx%22) + %22%3C%22);%0A    System.out.println(%22%3E%22 + test.countXX(%22xxx%22) + %22%3C%22);%0A    System.out.println(%22%3E%22 + test.countXX(%22xxxx%22) + %22%3C%22);%0A  %7D%0A%0A  int countXX(String str) %7B%0A    int counter = 0;%0A    %0A    for(int i = 0; i %3C str.length() - 1; i++)%7B%0A      if(str.substring(i, i+2).equals(%22xx%22))%7B%0A        counter += 1;%0A      %7D%0A    %7D%0A    %0A    return counter;%0A  %7D%0A%0A%7D%0A

add task countXX