Do not understand how to use Java Snippet


I'm having trouble understanding how to properly structure a Java Snippet's code. I am trying to use the getCell function to refer to a column's value, and use it for calculations later in the code. It is part of a recursive loop, so I cannot name the column specifically - I need it to refer to the column number dynamically

Example code is below - it tells me that 'void methods cannot return a value' - I do not understand why:

// Your custom variables:
public Double Total_Prev;
public Double Total_Now;
public Double Total_Next;
public Double New_Next;
public Integer New_End_Qtr;
public Integer Renewal_End_Qtr;
public Integer New_End_Yr;
public Integer Renewal_End_Yr;

// expression start
    public void snippet() throws TypeException, ColumnException, Abort {
// Enter your code here:
Total_Prev = getCell(168+v_currentIteration,tDouble);
Total_Now = getCell(172+v_currentIteration,tDouble);
Total_Next = getCell(176+v_currentIteration,tDouble);
New_Next = getCell(4+v_currentIteration,tDouble);
New_End_Qtr = getCell(28+v_currentIteration,tInt);
Renewal_End_Qtr = getCell(56+v_currentIteration,tInt);
New_End_Yr = getCell(84+v_currentIteration,tInt);
Renewal_End_Yr = getCell(112+v_currentIteration,tInt);

This is hard to diagnose without the workflow.

This getCell(168+v_currentIteration,tDouble); would get the cell from the 168th column in the first iteration and the 169th column in the second iteration.

Is this what you want to do?

Best, Iris