File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes currency format with java.text.DecimalFormat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "currency format with java.text.DecimalFormat" Watch "currency format with java.text.DecimalFormat" New topic
Author

currency format with java.text.DecimalFormat

Adrien Ruffie
Ranch Hand

Joined: Jan 14, 2009
Posts: 89
Hello All I have a small problem with DecimalFormat,

I have the following code:



But the problem is that, in database I have following value: 1 000 100 003 840 , and I need to print it like : 1 000 100 003 840 €, but the "value" is a BigDecimal and print like "1.0001E+12" and after the decimalFormat.format(value) I get following result "1 000 100 000 000,00" , do you know my problem, I loose 3 840 € ...

The format variable is the following string "###,##0.00"

Do you know a solution to this problem ?

Great thank and best regards,

Adryen


SCJP 5, SCDJWS 5
http://adrien-ruffie.blogspot.com
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 1939
    
  28
I ran the following code:

And the output was:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: currency format with java.text.DecimalFormat
 
Similar Threads
Reading a stream from a socket
Simple Question on float's string representation
Formatting values
Big Problem with decimalFormat
Rounding a float value upto 2 decimal places