Various algorithms implemented in Java