public static void main(String[] args) {
		int N = Integer.parseInt(args[0]);

		// add elements 1, ..., N
		System.out.println(N + " random integers between 0 and 99");
		DoublyLinkedList<Integer> list = new DoublyLinkedList<Integer>();
		for (int i = 0; i < N; i++)
			list.add((int) (100 * Math.random()));
		System.out.println(list);
		System.out.println();

		ListIterator<Integer> iterator = list.iterator();

		// go forwards with next() and set()
		System.out.println("add 1 to each element via next() and set()");
		while (iterator.hasNext()) {
			int x = iterator.next();
			iterator.set(x + 1);
		}
		System.out.println(list);
		System.out.println();

		// go backwards with previous() and set()
		System.out.println("multiply each element by 3 via previous() and set()");
		while (iterator.hasPrevious()) {
			int x = iterator.previous();
			iterator.set(x + x + x);
		}
		System.out.println(list);
		System.out.println();

		// remove all elements that are multiples of 4 via next() and remove()
		System.out.println("remove elements that are a multiple of 4 via next() and remove()");
		while (iterator.hasNext()) {
			int x = iterator.next();
			if (x % 4 == 0)
				iterator.remove();
		}
		System.out.println(list);
		System.out.println();

		// remove all even elements via previous() and remove()
		System.out.println("remove elements that are even via previous() and remove()");
		while (iterator.hasPrevious()) {
			int x = iterator.previous();
			if (x % 2 == 0)
				iterator.remove();
		}
		System.out.println(list);
		System.out.println();

		// add elements via next() and add()
		System.out.println("add elements via next() and add()");
		while (iterator.hasNext()) {
			int x = iterator.next();
			iterator.add(x + 1);
		}
		System.out.println(list);
		System.out.println();

		// add elements via previous() and add()
		System.out.println("add elements via previous() and add()");
		while (iterator.hasPrevious()) {
			int x = iterator.previous();
			iterator.add(x * 10);
			iterator.previous();
		}
		System.out.println(list);
		System.out.println();
	}