迭代数组java的和

时间:2014-08-26 14:22:40

标签: sum fixed-point

我需要根据迭代次数在Java中的数组中执行累积和,就像这样。

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;
}

因此,在每次迭代中,数组中的值[i] [j]增加,并且这些值存储在数组中。重复此过程直到最大迭代量 - 在第一个&#34; for&#34;中。

我的问题/麻烦是:如何在每次迭代后在数组中存储最终值?

非常感谢。

0 个答案:

没有答案
相关问题