Consecutive vowels counting ending up in an infinite loop
<p>I am trying to write a program that will read in a file, and find the word in the file that has the greatest number of consecutive vowels. I am doing this by getting each new word from the file, turning it into a charArray, and then evaluating the characters in the array to see if they are a vowel. A counter is kept for the number of consecutive vowels, and then if the counter for the current word is greater than the greatest previous counter value, the variable maxVowelString is set to the value of the current counter.</p>

<p>I have already resolved a number of errors with how I was handling the charArray, but when I run this in terminal, it does nothing, just ends up in an infinite loop. I can't figure out what's causing it. Does anyone have any ideas? (I am a bit new at coding, so there may be a logic error or something I don't understand).</p>

<p><strong>Update:</strong> I made several of the suggested changes, and went through and debugged it. The program is getting stuck in this specific loop, but I can't figure out why.</p>

<pre><code>    while ((i + n) &lt; lowercase.length())    
                {
                    System.out.println("i + n " + (i + n));
                    if ((charsList.get(i+n) == 'a') || (charsList.get(i+n) == 'e') || (charsList.get(i+n) == 'i') || (charsList.get(i+n) == 'o') || (charsList.get(i+n) == 'u'))
                    {
                        isVowel = true;
                        counter++;
                        System.out.println("counter " + counter);
                        i++;
                    }
                    else
                    {
                        isVowel = false;
                    } 
                }
</code></pre>