I'm trying to change my arrayList to an array but not sure how to change the
rhs += weightsarray.get[i];
In my code below, it keeps giving me errors:
if(weightsarray == null || weightsarray.length == 0)
return -1;
double lhs = 0.0,rhs = 0.0;
int n = scasol.length();
for(int i = 0; i < n; i++) {
char character = scasol.charAt(i);
if(character == '1') {
rhs += weightsarray.get[i];
} else {
lhs += weightsarray.get(i);
}
}
return(Math.abs(lhs-rhs));
}
The arraylist was where the weightsarray is now
If anyone could help that would be great, if you need any more info let me know (One of my first times using this so not really 100% sure how it works)
Cheers