Math.ceil() is the correct function to call. I'm guessing a is an int , which would make a / 100 perform integer arithmetic. Try Math.ceil(a / 100.0) instead.
stackoverflow.com