2011-02-08 14 views

回答

4

或者您可以使用另一種方法:

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; 
1

Math.ceil() or Math.floor()可能,但這些又是僅適用於CLDC 1.1 :)