When I use the operator % in my Java programs, I keep getting negative answers. Example: -1%100 gives -1. While this is mathematically correct, I want to get the normal mathematical solution, or 99. In other words, I want to get the smallest positive integer solution. Is there any simple solution for this in Java (perhaps something I overlooked in Math? — I can’t find it)?
I also want to clarify that if there is something in the API that does this, a link would be awesome.
You can just do this?
This should work for any positive
d.