public static void main(String[] args) {
    Random gen = new Random();
    for (int times = 0; times < 1000; ++times) {
      int n;
      if (args.length == 1) {
        n = Integer.parseInt(args[0]);
      } else {
        n = gen.nextInt(1000) + 1;
      }
      node_t<Integer> head = null;
      for (int i = n; i >= 0; --i) {
        node_t<Integer> curr = new node_t<Integer>(i, null);
        curr.next = head;
        head = curr;
      }
      node_t<Integer> curr = head;
      if (curr != null) {
        while (curr.next != null) {
          curr = curr.next;
        }
        curr.next = head;  // make the list as a circular list.
      }
      double res = find_median_sorted_circular_linked_list(head.next);
      System.out.println(res);
      assert(res == 0.5 * n);
    }

    // Test empty list.
    node_t<Integer> head = null;
    try {
      find_median_sorted_circular_linked_list(head);
    }
    catch (IllegalArgumentException e) {
      System.out.println(e.getMessage());
    }

    // Test identical list.
    for (int i = 0; i < 10; ++i) {
      node_t<Integer> curr = new node_t<Integer>(5, null);
      curr.next = head;
      head = curr;
    }
    node_t<Integer> curr = head;
    if (curr != null) {
      while (curr.next != null) {
        curr = curr.next;
      }
      curr.next = head;  // make the list as a circular list.
    }
    assert(5 == find_median_sorted_circular_linked_list(head));
  }