~~~~0L-src/main/java/org/pack/ExerciseSumArray.java
public class ExerciseSumArray {
    /*
    Given 2 Lists representing numbers (e.g., [3,4] = 34, [9,8] = 98),
    calculate the sum of 2 Lists, and return the result in an List.
    For example:
    [1, 0, 0] + [4,0] = [1,4,0]
    [6,7] + [0] = [6,7]
     */
}
~~~~

~~~~0R-src/main/java/org/pack/ExerciseSumArray.java
public class ExerciseSumArray {
    /*
    Given 2 Lists representing numbers (e.g., [3,4] = 34, [9,8] = 98),
    calculate the sum of 2 Lists, and return the result in an List.
    For example:
    [1, 0, 0] + [4,0] = [1,4,0]
    [6,7] + [0] = [6,7]
     */
    public ArrayList<Integer> getSum(List<Integer> firstNumber, List<Integer> secondNumber ){
        ArrayList<Integer> result = new ArrayList<Integer>();

        int carry = 0;
        Collections.reverse(firstNumber);
        Collections.reverse(secondNumber);

        for (int i = 0; (i < Math.max(firstNumber.size(), secondNumber.size())); i ++){
            Integer firstValue = i < firstNumber.size() ? firstNumber.get(i) : null;
            Integer secondValue = i < secondNumber.size() ? secondNumber.get(i) : null;

            int res = firstValue + secondValue + carry;

            carry = 0;
            if (res > 10){
                carry = 1;
                res = res % 10;
            }
            result.add(res);
        }

        if (carry >= 0)
            result.add(carry);

        Collections.reverse(result);
        return result;
    }
}
~~~~

~~~~1L-src/test/java/org/pack/ExerciseSumArray.java
public class ExerciseSumArrayTests {
}
~~~~

~~~~1R-src/test/java/org/pack/ExerciseSumArray.java
public class ExerciseSumArrayTests {
    @Test
    public void simpleSumTest(){
        ExerciseSumArray ex = new ExerciseSumArray();
        List<Integer> first = Arrays.asList(6,8);
        List<Integer> second = Arrays.asList(5,0);
        List<Integer> result = Arrays.asList(1,1,8);

        assertEquals(result, ex.getSum(first, second));
    }

    @Test
    public void sumNumbersDifferentLengthTest(){
        ExerciseSumArray ex = new ExerciseSumArray();
        List<Integer> first = Arrays.asList(4,9);
        List<Integer> second = Arrays.asList(7,8);
        List<Integer> result = Arrays.asList(1,2,7);

        assertEquals(result, ex.getSum(first, second));

    }

    @Test
    public void sumZeroTest(){
        ExerciseSumArray ex = new ExerciseSumArray();
        List<Integer> first= Arrays.asList(6,7);
        List<Integer> second = Arrays.asList(5,5);
        List<Integer> result = Arrays.asList(1,2,2);

        assertEquals(result, ex.getSum(first, second));

    }
}
~~~~
