This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes NumberFormat API question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "NumberFormat API question" Watch "NumberFormat API question" New topic

NumberFormat API question

Ranch Hand

Joined: Mar 06, 2001
Posts: 123
Hi all,
I ran into a problem with the NumberFormat
class and I was wondering if someone had
a solution. Basically, if I run the
following snippet
NumberFormat format = NumberFormat.getInstance();
I get 5.8. However, what I really expected to see
was 5.80. Does anyone know of a nice workaround to
fix this problem?
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
<pre> format.setMinimumFractionDigits(2);</pre>

"I'm not back." - Bill Harding, Twister
Ranch Hand

Joined: Mar 06, 2001
Posts: 123
Thanks Jim ... PJ
jQuery in Action, 2nd edition
subject: NumberFormat API question
Similar Threads
convert $1,351.63 to: 1351.63
Is it possible to reformat the output from a double value?
question on NumberFormat class
Format and NumberFormat format() method
Problem with printf output