Best way to make Java's modulus behave like it should with negative numbers?
Asked 2010-12-10T18:43:56.203
139
In java when you do
a % b
If a is negative, it will return a negative result, instead of wrapping around to b like it should. What's the best way to fix this? Only way I can think is