The break statement will only break out of the inner loop and return to the outer loop which then continues running. If you want the method to end then replace the break with a return statement.