public boolean hasCycle(ListNode head) {
        boolean res = false;
        if(head == null){
            return res;
        }
        if(head.next==null){
            return res;
        }
        
        ListNode fastP = head;
        ListNode slowP = head;
        
        while ( fastP.next != null ){
            if( fastP.next.next == null){
                res = false;
                break;
            }else{
                fastP = fastP.next.next;
            	slowP = slowP.next;
            	if(fastP == slowP){
            		res = true;
            		break;
            	}
            }
        }
        
        return res;
    }