Is there a rounding function in J2ME?

I need a rounding function in J2ME. Math.round () does not seem to exist. Please help!

+3
source share
2 answers

Or you can use a different 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;
+4
source

Math.ceil() or Math.floor() possible, but they are only available again for CLDC 1.1 :)

+1
source

Source: https://habr.com/ru/post/1790636/


All Articles