Ah, crud, you're out of luck then XD
I guess you're stuck with classic loops unless some kind of abstraction helps you with that (in Java <8 it's still a mess anyway).
I discovered that I pasted the code wrong, so I've edited the post to correct that. In the original version I could have written a function to find the index in the array, but I can't do that for the correct version.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.