Various search algorithm in Java