Stop Microsoft
Miscellaneous => Programming & Networking => Topic started by: Xeen on 15 June 2004, 20:36
-
say I have the numbers:
float x = 1.23456
and
double y = 4.5678
How do I get them to be rounded off to the nearest tenth? (x should become 1.2 and y should become 4.6). ?
I know how this is done in C/C++, but I can't figure it out in java.
-
Math.round(f*10)/10f