Reverse a Link List

private static Node reverseList(Node head){
Node temp=null;
Node temp2=null;
//Initial state- set temp pointer at head->next
if(head.next!=null)temp=head.next;
//Set head.next null as this will eventually become last node
head.next=null;
while(temp!=null)
{
//Temporary pointer 2 to be placeholder of temp.next
temp2=temp.next;
temp.next=head;
head=temp;
temp=temp2;
}
return head;
}