I have a for loop that for the life of me I cant figure out why it isnt incrementing properly. I know that it is due to the 'If Statement' that is nested in the first For Loop but I have no idea how to fix it. Any help would be greatly apreciated.
public static boolean ifMatches(String word){
String[] split = word.split("z");
for(int i = 0; i<split.length; i++){
if(vowelCount(split[i]) == 2){
return true;
}else{
return false;
}
}
return false;
}
public static int vowelCount(String part){
int vowelCounter = 0;
for( int i = 0; i <part.length(); i++){
if(isVowel(part.charAt(i)))
vowelCounter++;
}
return vowelCounter;