PUBS: A Practical Upper Bounds Solver

class ListInter {
 static ListReverse listInter(ListReverse l1,ListReverse l2){
        ListReverse r=new ListReverse();
       	r.next=null;
        ListReverse last = r;
	ListReverse aux = l1;
	while (aux!=null){
	    if (find(l2,aux.data)==1){
	        ListReverse node=new ListReverse();
		node.data=aux.data;
		node.next=null;
		last.next=node;
		last=node;
	
	    }
	 aux=aux.next;
	}
	r=r.next;
	return r;
 }
        
        static int find(ListReverse l,int e){
	    ListReverse aux=l;
	    while (aux!=null && aux.data != e) aux=aux.next;
            if (aux!=null) return 1;
	    else return 0; 
	}
}