.add(j, i); not updating array
The code below works, but index.add(j, i) does not update when highest does? I need to know which ones in the array were selected to be the highest. I have also tried using a variable and using (array.add(index)), near array.add(highest); is, but it always says 0. array does contain the correct highest values, so highest = array.get(i); must work?
Also print statements do not work near highest = array.get(i);?
Code :
for (int j =0; j<7; j++) {
index.add(j, 0);
int highest = array.get(j*7+1);
for (int i = 2+(j*7); i<7+(j*7)+1;i = i+7+1) {
if highest<array.get(i)) {
index.add(j, i);
highest = array.get(i);
}
}
array.add(highest);
}
Thanks
Re: .add(j, i); not updating array
If you want help, you should provide an SSCCE that demonstrates what you're trying to do. Looking at the code you provided, we can't really tell what's going on. What is index? What is the input? What's the output?