public ListNode addTwoNumbers(ListNode l1, ListNode l2) {

        ListNode result = null;
        ListNode current = null;
        boolean needCarry = false;
        do{
            if(result != null){
                l1 = l1.next == null ? new ListNode(0) :l1.next;
                l2 = l2.next == null ? new ListNode(0) :l2.next;
            }
            int val = 0;
            if(needCarry){
                val = 1;
            }
            val = val + l1.val + l2.val;

            if(val >= 10){
                needCarry = true;
                val = val % 10;
            }else{
                needCarry = false;
            }

            if(result == null){
                result = new ListNode(val);
                current = result;
            }else{
                current.next = new ListNode(val);
                current = current.next;
            }
        }while(l1.next!=null || l2.next!=null);
        if(needCarry){
            current.next = new ListNode(1);
        }
        return result;
    }