Re: Format decimals places

Discussion in 'Java' started by Tang Chun Chung, Jun 28, 2003.

  1. "JL Smith" <> wrote in
    news:_N0Ka.568$:

    > 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
    Tang Chun Chung, Jun 28, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hansiman
    Replies:
    1
    Views:
    19,350
    =?Utf-8?B?S2VuIENveCBbTWljcm9zb2Z0IE1WUF0=?=
    Oct 8, 2004
  2. JeffP@Laptop

    How do I Format Currency w/out decimals?

    JeffP@Laptop, Dec 13, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    15,713
    =?Utf-8?B?RWx0b24gVw==?=
    Dec 15, 2005
  3. D. Shane Fowlkes

    Format DataItem as Currency and NO decimals

    D. Shane Fowlkes, Mar 20, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    4,896
    Nathan Sokalski
    Mar 21, 2006
  4. JDC
    Replies:
    3
    Views:
    430
    Damien
    Jun 28, 2006
  5. i.v.r.
    Replies:
    11
    Views:
    250
    Logan Capaldo
    Nov 2, 2005
Loading...

Share This Page