Is there a round off function in J2ME?

こ雲淡風輕ζ 提交于 2019-12-10 21:54:52

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!