Hello All!
I would greatly appriciate some help given I'm just starting out in Java. I have written a pice of code which includes a lot of "for" statments (a few of them are called below). Since they are essentially doing the same thing, (Adding the last X elements of different arrays to a different variable) would it be possible to simplfy this into a process that keeps getting called instead of writting a new for loop everytime i want to do this?
Thank you in advance for anyone that can help out with this
I would greatly appriciate some help given I'm just starting out in Java. I have written a pice of code which includes a lot of "for" statments (a few of them are called below). Since they are essentially doing the same thing, (Adding the last X elements of different arrays to a different variable) would it be possible to simplfy this into a process that keeps getting called instead of writting a new for loop everytime i want to do this?
Code:
for (int n = 1; n < 100; n++) {
Variable1 += Array1.get(Array1.size() - n);
for (int j = 1; j < 40; j++) {
Variable2 += Array2.get(Array2.size() - j);
for (int l = 1; l < 93; l++) {
Variable3 += Array3.get(Array3.size() - l);
Comment