package CtCILibrary;

public class LinkedListNode {
	public LinkedListNode next;
	public LinkedListNode prev;
	public LinkedListNode last;
	public int data;
	public LinkedListNode(int d, LinkedListNode n, LinkedListNode p) {
		data = d;
		setNext(n);
		setPrevious(p);
	}
	
	public LinkedListNode() { }

	public void setNext(LinkedListNode n) {
		next = n;
		if (this == last) {
			last = n;
		}
		if (n != null && n.prev != this) {
			n.setPrevious(this);
		}
	}
	
	public void setPrevious(LinkedListNode p) {
		prev = p;
		if (p != null && p.next != this) {
			p.setNext(this);
		}
	}	
	
	public String printForward() {
		if (next != null) {
			return data + "->" + next.printForward();
		} else {
			return ((Integer) data).toString();
		}
	}
	
	public LinkedListNode clone() {
		LinkedListNode next2 = null;
		if (next != null) {
			next2 = next.clone();
		}
		LinkedListNode head2 = new LinkedListNode(data, next2, null);
		return head2;
	}
}

@@ -17,16 +17,47 @@
 ary;%0D%0A%0D%0A
+import java.util.ArrayList;%0D%0A%0D%0A
 public c
@@ -1017,12 +1017,388 @@
 d2;%0D%0A%09%7D%0D
+%0A%0D%0A%09public int%5B%5D toIntArray() %7B%0D%0A%09%09ArrayList%3CInteger%3E intArrayList = new ArrayList%3CInteger%3E();%0D%0A%09%09LinkedListNode node = this;%0D%0A%09%09while (node.next != null) %7B%0D%0A%09%09%09intArrayList.add(node.data);%0D%0A%09%09%09node = node.next;%0D%0A%09%09%7D%0D%0A%09%09int%5B%5D intArray = new int%5BintArrayList.size()%5D;%0D%0A%09%09int i = 0;%0D%0A%09%09for (Integer n : intArrayList) %7B%0D%0A%09%09%09intArray%5Bi%5D = n;%0D%0A%09%09%09i++;%0D%0A%09%09%7D%0D%0A%09%09return intArray;%0D%0A%09%7D%0D
 %0A%7D%0D%0A

Add testing method, toIntArray.