You are viewing a single comment's thread. Return to all comments →
what if newLocation becomes negative
then you send it to the end of the array
The modulus operation always returns positive. If, as in Java, it really does remainder, rather than the mathematical modulus, it can return negative. So, depends on which language.