I am trying to add two non negative numbers, the digits of which are stored in reverse order in two separate linked lists. The answer should also be a linked list with digits reversed and no trailing zeros. 

I understand that there is a way to solve this question by adding digits and maintaining a carry each time, but I am trying to solve it by using addition operation on numbers.

Here's my code:

```
    /**
     * Definition for singly-linked list.
     * class ListNode {
     *     public int val;
     *     public ListNode next;
     *     ListNode(int x) { val = x; next = null; }
     * }
     */
    public class Solution {
        public ListNode addTwoNumbers(ListNode a, ListNode b) {
            if(a==null || b==null){
                return null;

}
        String num1 = "";
        String num2 = "";
        ListNode temp1 = a;
        ListNode temp2 = b;
        while(temp1!=null){
            num1 = num1+Integer.toString(temp1.val);
            temp1 = temp1.next;
        }
        new StringBuilder(num1).reverse().toString();
        double value1 = Double.parseDouble(num1);
        while(temp2!=null){
            num2 = num2+Integer.toString(temp2.val);
            temp2 = temp2.next;
        }
        new StringBuilder(num2).reverse().toString();
        double value2 = Double.parseDouble(num2);
        double result = value1+value2;
        String res = String.format("%.0f",result);
        ListNode first_node =  new ListNode(Character.getNumericValue(res.charAt(0)));
        ListNode ans  = first_node;
        for(int j=1;j<res.length();j++){
            ListNode node = new ListNode(Character.getNumericValue(res.charAt(j)));
            add(node,ans);
        }
        return ans;
    }
    public void add(ListNode node, ListNode ans){
        ListNode temp;
        temp = ans;
        ans  = node;
        ans.next = temp;
    }
}

```

My code has been giving wrong answers. Can anyone point out the errors?