开发者

Is there a round off function in J2ME?

I need roundoff function in J2ME. Math.round() does n开发者_如何学编程ot seem to exist. Please provide some assistance!


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;


Math.ceil() or Math.floor() probably but these again are available only for CLDC 1.1 :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜