What is the initial value of of hi and lo that is passed to the function.

The exception you are talking about looks like hi is not within the range of arr.