maybe change these to != Integer.MAX_VALUE. because clearly all are <=, so requiring < implies !=, which, I think, is clearer to the reader that you are reserving a special value.