The problem in your code is that you use new String that is not optimal and future more you have an infinite loop the cause your heap to end.
Inside the while loop you never change the value of variable 'page' because of that when skip the if that you call break you will skip it every time.