This code for detecting cycle in a linked list is not covering all test cases, can you suggest any changes? I tried to cover every possible case

boolean hasCycle(Node head) {
int count1=1;
int count2=2;
if(head==null){
return false;
}

if(head.next==null){
    return false;
}
 if(head.next.next==null){
    return false;
}

    Node temp1=head.next;
    Node temp2=head.next.next;
    while(temp1==temp2){
        if(temp1.next==null || temp2.next==null || temp2.next.next==null ||temp1==null||temp2==null){
            
            return false;
        }
        temp1=temp1.next;
        temp2=temp2.next.next;
        
        if(temp1==temp2){
            return true;
        }
        
    }
    if(temp1==null)
        return false;
    return true;

}

return true; // should be removed