public static boolean hasCycle(ListNode head) {
        if(null==head) return false;
        ListNode pointerOne=head.next;
        if(null==pointerOne) return false;
        ListNode pointerTwo=head.next.next;
        while (pointerOne!=null&&pointerTwo!=null&&pointerOne!=pointerTwo){
            pointerOne=pointerOne.next;
            if(null==pointerTwo.next) break;
            pointerTwo=pointerTwo.next.next;
        }
        if(null==pointerOne||null==pointerTwo){
            return false;
        }
        if(pointerOne==pointerTwo){
            return true;
        }
        return false;
    }