private static ListNode merge(ListNode head1, ListNode head2) {
		if (head1 == null) {
			return head2;
		} else if (head2 == null) {
			return head1;
		}
		ListNode head, index;
		if (head1.val <= head2.val) {
			head = head1;
			head1 = head1.next;
		} else {
			head = head2;
			head2 = head2.next;
		}
		index = head;
		while (head1 != null && head2 != null) {
			if (head1.val <= head2.val) {
				index.next = head1;
				head1 = head1.next;
			} else {
				index.next = head2;
				head2 = head2.next;
			}
			index = index.next;
		}
		if (head1 != null) {
			index.next = head1;
		}
		if (head2 != null) {
			index.next = head2;
		}
		return head;
	}