Methods that return ArrayIntList
<p>I'm working on the following question:</p>

<blockquote>
  <p>Write a method runningTotal that returns a new ArrayIntList that contains a running total of the original list. In other words, the i th value in the new list should store the sum of elements 0 through i of the original list.</p>
</blockquote>

<p>I'm stuck in the last part of second method(return). The method which doesn't have a parameter.</p>

<pre><code>public class ArrayIntList {

    private int[] elementData;
    private int size;

}

// when client calls : test = ArrayIntList.runningTotal(test);
// the folowing method works fine

public static ArrayIntList runningTotal(ArrayIntList other) {

    other.elementData[0] = other.elementData[0];
    for(int i = 1; i &lt; other.size; i++){
        other.elementData[i] = other.elementData[i]+ other.elementData[i-1];
    }
    return other;
}
// when client calls: test = test.runningTotal();
public ArrayIntList runningTotal() {
    elementData[0] = elementData[0];
    for(int i = 1; i &lt; size; i++){
        elementData[i] = elementData[i]+ elementData[i-1];
    }
    return ??;
}
</code></pre>
