in NuberFormat, Please use the fucntion setMaximumDecimalPoints and Miminum
Decimal Points.
-Original Message-
From: Josh G [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 14, 2002 05:54 PM
To: Tomcat Users List
Subject: Java q: round to n decimal points?
Is there a nice easy way to
Ya, you have to create a DecimalFormat, and then set it with 2 decimal
places, and then create a string, with the double as the parameter, where
the string will be the 'parsed' double.
S
- Original Message -
From: "Josh G" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
S
- Original Message -
From: "Josh G" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Thursday, November 14, 2002 7:53 AM
Subject: Java q: round to n decimal points?
> Is there a nice easy way to round a double to n decimal points? I couldn't
> see anything in Math,Do
It's quite easy:
multiply your double with 10^n, do a simple round, and divide
it by 10^n
Carsten
Am Donnerstag, 14.11.02, um 07:53 Uhr (Europe/Berlin) schrieb Josh G:
Is there a nice easy way to round a double to n decimal points? I
couldn't
see anything in Math,Double,String, or NumberForma