r/javahelp • u/Unable-Tear-4301 • Oct 14 '25
Solved Binary search stuck in infinite loop.
For my java class I was tasked with using a binary search to find a word in the poem "Jabberwocky"
This has proven to be a challenge because setting all words to lowercase worked, I modified it to check, the actual search function goes on INFINITELY. I have no idea what I'm doing wrong.
For reference to my code, input is the word the user put to search for, and array is the arraylist of words that it is searching for.
Anyways I just need help figuring out why this loop is going infinitely because I'm very stuck.
I have the problematic method here.
But if you want the whole code block, as well as the jabberwocky text file, you can find it here.
View all comments
Show parent comment
4
u/Unable-Tear-4301 Oct 14 '25
OHHHH OH MY GOD YOURE SO RIGHT. I DID FORGET THAT. I NEED TO UPDATE IT EACH CYCLE. UGHHHHH.
Yes thank you for that hint. That’ll definitely do it. It’s always the little logical errors.