public static <T> node_t<T> has_cycle(node_t<T> head) {
    node_t<T> fast = head;
    node_t<T> slow = head;

    while (slow != null && slow.next != null && fast != null 
                        && fast.next != null && fast.next.next != null) {
      slow = slow.next;
      fast = fast.next.next;
      if (slow == fast) {  // there is a cycle.
        // Tries to find the start of the cycle.
        slow = head;
        // Both pointers advance at the same time.
        while (slow != fast) {
          slow = slow.next;
          fast = fast.next;
        }
        return slow;  // slow is the start of cycle.
      }
    }
    return null;  // means no cycle.
  }