This is my code ..

class Link{
public String Name,Sex, Dob;

public int ssn,salary;
public Link next,previous;




Link(String nName,int Snum,String g,int sal,String dob){
Name=nName;
ssn=Snum;
Sex=g;
salary=sal;
Dob=dob;

}
void displayLink(){
System.out.println(Name+"\t"+ssn+"\t"+Sex+"\t"+sal ary+"\t"+Dob);
}

public class DoublyLinkList {

private Link Head;
private Link Tail;
int entries;

DoublyLinkList(){
Head=null;
Tail=null;
entries=0;
}

public void ProcessWhileInsert(String p,int SN,String k,int sal,String d){
Link current=Head;
Link previous=null;
Link thisLink=new Link(p,SN,k,sal,d);


while(current !=null && SN > current.ssn){
{
previous=current;
current=current.next;}



if(previous==null){
Head=thisLink;
entries++;}
else
{
thisLink.next=current;
thisLink.previous=current.previous;
current.previous=thisLink;
entries++;}
} }

public void DisplayList(){
Link current=Tail;
System.out.println("Name\tSSN\tSEX\tSALARY\tDOB");
while(current!=null){

current.displayLink();
current=current.previous;
}
System.out.println("Number of entries:"+entries);
}


If i just insert without sorting i can insert
when i try to insert whle sorting i can't even insert..
can someone tell me whats wrong with this sorting algorithm. Its a doubly linked list
Thanks