@@ -0,0 +1,917 @@
+package package7;%0A%0Aimport java.util.ArrayList;%0A%0Apublic class LinkedListController %7B%09%0A%09%0A%09public Element newList(int x)%7B%0A%09%09Element a = new Element(x, true, null, null);%0A%09%09return a;%0A%09%7D%0A%09%0A%09public int getLength(Element e)%7B%0A%09%09int n = 0;%0A%09%09%0A%09%09while(e != null) %7B%0A%09%09%09e = e.getNext();%0A%09%09%09n++;%0A%09%09%7D%0A%09%09%0A%09%09return n;%0A%09%7D%0A%09%0A%09public void insertAtEnd(Element e, int x)%7B%0A%09%09while(e.getNext() != null)%7B%0A%09%09%09e = e.getNext();%0A%09%09%7D%0A%09%09%0A%09%09e.insertAfter(x);%0A%09%7D%0A%09%0A%09//First element has index 0%0A%09public int getnth(Element e, int n)%7B%0A%09%09for(int i = 0; i %3C n; i++)%7B%0A%09%09%09e = e.getNext();%0A%09%09%7D%0A%09%09return e.getVal();%0A%09%7D%0A%09%0A%09public boolean hasCycle(Element e)%7B%0A%09%09boolean hasCycle = false;%0A%09%09ArrayList%3CElement%3E elements = new ArrayList%3CElement%3E();%0A%09%09%0A%09%09while(e != null)%7B%0A%09%09%09for(int i = 0; i %3C elements.size(); i++)%7B%0A%09%09%09%09if(e == elements.get(i))%7B%0A%09%09%09%09%09hasCycle = true;%0A%09%09%09%09%09break;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%09elements.add(e);%0A%09%09%09e = e.getNext();%0A%09%09%7D%0A%09%09%0A%09%09return hasCycle;%0A%09%7D%0A%7D%0A

Create LinkedListController.java