Its hard to give another approach given how abstract the code samples are, but as braindigitalis say if you are searching for something change the storage to something more suitable to perform a lookup. Also have others have said create a function that does the scan and returns the result so the return does the break.
From you sample this is faster to do the same lol
int i = 2;
int j = 0;
Ignore the try/catch exception route as it carries costs that make it perform worse than the other solutions presented.