for (int k = 0; k <= t - 2; k++) { double a, b; a = A.get(0) + (-gt(k + 1) + 640 + rt(0)); b = A.get(k + 1) + rt(k + 1); if (a > b) { B.add(b); } else { B.add(a); } } It is necessary that at each iteration of the cycle in formulas a and b first element A.get(0) from A.get(0) and A.get(k + 1) to B.get(0) and B.get(k + 1) .
A.getyou need to useB.get, replace the letterAwithBand use. What is the question / problem? - Regent