- private static void countExist() {
- String max = "aeaeaeae";
- String min = "ae";
- int count = 0;
- int index = 0;
- while(index < max.length() - min.length() + 1) {
- if (max.indexOf(min, index) >= index) {
- index = index + min.length();
- } else {
- count++;
- break;
- }
- }
- System.out.println(count == 4);
- }
复制代码
|
|