Quote:
Originally Posted by linuxmandrake
How do I do it in java. Am using 1.4.2 and must do
|
use the DecimalFormat class
DecimalFormat myFormat;
myFormat = new DecimalFormat("0.00") // the 0.00 sets 2 for 2 3 for 3 and so on
then when outputting call it
//if using System.out.println
System.out.println(myformat.Format(2.68546846484));
************************************************
EDIT
************************************************
Sorry rushed in response and thought you were looking to format your output. sorry
which would output 2.68