I should probably know that but I'm not sure what this line of code is doing:
int iEnd=i==grid.length - 1 ? 0:1;
I should probably know that but I'm not sure what this line of code is doing:
int iEnd=i==grid.length - 1 ? 0:1;
it will set iEnd to 0 if i equals grind.length -1 otherwise it will set iEnd to 1
the operator is called Ternary Operator
and is a short hand for a Conditional Operator
and you can read more about it here: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html