Implemented linked list cycles in Java.