0

I need to perform an accumulative sum in an array in Java according to iteration number, like this.

for (int it = 1; it < 3; it++) {    
     for(int i = 0; i < simSource.length; i++) {
          for (int j = 0; j < resulting.length; j++) {
                    results [i][j]  = resulting[i][j] +  (simSource[i] * 0.5)/3;
          }
     }
          newResults = results;
}

Thus, in each iteration, the values in the array results[i][j] increase, and these values, are stored in an array. This process is repeated until the max amount of iterations - in the first "for".

My question/trouble is: How to store in the array the final values after each iteration?

Thank you very much.

Nadim Baraky
  • 459
  • 5
  • 18
gPxl
  • 95
  • 14

0 Answers0