问题
I need roundoff function in J2ME. Math.round() does not seem to exist. Please provide some assistance!
回答1:
Or you can use another approach:
float value;
int base; //base to round
int round_down=(int )((int )(value/base))*base;
int round_up=(int )((int )(value/base+0.5))*base;
回答2:
Math.ceil() or Math.floor()
probably but these again are available only for CLDC 1.1 :)
来源:https://stackoverflow.com/questions/4930598/is-there-a-round-off-function-in-j2me