Formatting a number, placing the decimal in the proper place

Discussion in 'Java' started by BoomerangThree, Aug 20, 2004.

  1. Can someone help me out on formatting a number and getting the decimal in
    the right place?

    1) I have the number 8883.
    2) I would like to format the number so it shows up as 88.33.

    Thanks for any support, past, present, and future...

    --
    BoomerangThree
    BoomerangThree, Aug 20, 2004
    #1
    1. Advertising

  2. On Thu, 19 Aug 2004 21:43:15 -0400, BoomerangThree wrote:

    Hi BoomerangThree..

    Is there some more significance to that name?

    The 'Boomerang', I understand, since I have
    already seen this exact same post on
    c.l.j.help, more commonly referred to
    'round here as multi-posting, further details..
    <http://www.physci.org/codes/javafaq.jsp#xpost>

    BTW, Please don't (multi-post).

    No, what *I* was wondering about your name is,
    ...does the 'Three' mean I am about to see this
    same post in a *third* group?

    I recommend you restrict your posts to c.l.j.help
    for the time being, and you might want to zip on
    back and ensure that you make your expected inputs
    and outputs clear..

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology
    Andrew Thompson, Aug 20, 2004
    #2
    1. Advertising

  3. Understand. Won't happen again.


    "Andrew Thompson" <> wrote in message
    news:lm97wks2b3qn$...
    > On Thu, 19 Aug 2004 21:43:15 -0400, BoomerangThree wrote:
    >
    > Hi BoomerangThree..
    >
    > Is there some more significance to that name?
    >
    > The 'Boomerang', I understand, since I have
    > already seen this exact same post on
    > c.l.j.help, more commonly referred to
    > 'round here as multi-posting, further details..
    > <http://www.physci.org/codes/javafaq.jsp#xpost>
    >
    > BTW, Please don't (multi-post).
    >
    > No, what *I* was wondering about your name is,
    > ..does the 'Three' mean I am about to see this
    > same post in a *third* group?
    >
    > I recommend you restrict your posts to c.l.j.help
    > for the time being, and you might want to zip on
    > back and ensure that you make your expected inputs
    > and outputs clear..
    >
    > --
    > Andrew Thompson
    > http://www.PhySci.org/ Open-source software suite
    > http://www.PhySci.org/codes/ Web & IT Help
    > http://www.1point1C.org/ Science & Technology
    BoomerangThree, Aug 20, 2004
    #3
  4. BoomerangThree

    Jacob Guest

    BoomerangThree wrote:

    > Can someone help me out on formatting a number and getting the decimal in
    > the right place?
    >
    > 1) I have the number 8883.
    > 2) I would like to format the number so it shows up as 88.33.


    Look at java.text.DecimalFormat. You can use it to transform
    a double number to a string in just about any conceivable way.

    BUT: It will not change the number as such, so you'd have to
    produce the correct value first, possibly by dividing by 100
    (taken that 8883 -> 8833 is a typo).

    An alternative approach if your input is just a sequence of
    *characters* (a String) rather than a number, you can produce
    your desired output by string manipulation, i.e. insert a
    decimal point at the correct spot in the string
    Jacob, Aug 20, 2004
    #4
    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. martin
    Replies:
    1
    Views:
    457
    Rick Strahl [MVP]
    Jul 19, 2004
  2. Luis Esteban Valencia

    Formatting decimal number

    Luis Esteban Valencia, Jan 12, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    526
    Philip Q [MVP]
    Jan 12, 2005
  3. stu
    Replies:
    13
    Views:
    6,216
    Ranganath Kini
    Feb 7, 2006
  4. KS
    Replies:
    7
    Views:
    622
    Michael Winter
    Nov 10, 2004
  5. Replies:
    0
    Views:
    272
Loading...

Share This Page