rounding a large double to 2 decimal places
How do I do it in java. Am using 1.4.2 and must do
|
Magic Google 8-Ball said: http://www.codecomments.com/archive2...-8-537423.html
|
Quote:
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 |
All times are GMT -5. The time now is 09:14 PM. |