Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Re: Format decimals places (http://www.velocityreviews.com/forums/t123853-re-format-decimals-places.html)

Tang Chun Chung 06-28-2003 06:09 AM

Re: Format decimals places
 
"JL Smith" <leesmith@myspeedworks.com> wrote in
news:_N0Ka.568$IP6.26208@eagle.america.net:

> Hello,
>
> I have a double and I want it to always have two decimal places behind
> it. How would I do this? Thanks for any help!
>
>
>


Hello,

You can make use of the class NumberFormat or the class DecimalFormat
in the java.text package. They provide many manipulation on the number
representation. The method setMaximumFractionDigits() is the one you want I
think. Hope this can help you.

Benny Tang


All times are GMT. The time now is 12:55 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57