Various searching algorithms in Java