public static ListNode mergeTwoLists(ListNode l1, ListNode l2) {
        ListNode addihead = new ListNode(0);
        ListNode p1 = l1;
        ListNode p2 = l2;
        ListNode p3 = addihead;
        while (p1 != null && p2 != null) {
            if (p1.val < p2.val) {
                ListNode temp = new ListNode(p1.val);
                p3.next = temp;
                p3 = temp;
                p1 = p1.next;
            }
            else {
                ListNode temp = new ListNode(p2.val);
                p3.next = temp;
                p3 = temp;
                p2 = p2.next;
            }
        }
        while (p1 != null && p2 == null) {
            ListNode temp = new ListNode(p1.val);
            p3.next = temp;
            p3 = temp;
            p1 = p1.next;
        }
        while (p2 != null && p1 == null) {
            ListNode temp = new ListNode(p2.val);
            p3.next = temp;
            p3 = temp;
            p2 = p2.next;
        }
        return addihead.next;
    }