public static boolean isintersect(ListNode head1, ListNode head2){
        if(head1 == null || head2 == null){
            return false;
        }
        while (head1.next != null){
            head1 = head1.next;
        }
        while (head2.next != null){
            head2 = head2.next;
        }
        return head1 == head2;
    }