aspose file tools*
The moose likes Beginning Java and the fly likes Regd. NumberFormat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Regd. NumberFormat" Watch "Regd. NumberFormat" New topic
Author

Regd. NumberFormat

Balasubramani Dharmalingam
Ranch Hand

Joined: Dec 06, 2004
Posts: 116
I want to format the double number in Italian format.When i trying the following code, its truncating the decimal fields. But i want same decimal points after formating. How to get it..?

Code:


Output:
123.456.789.012,123

Expected output:
123.456.789.012,12345678

Thanks in advance.


Balasubramani SD,<br />SCJP 1.4,SCWCD 1.4,SCJP 5.0<br /><a href="http://sd.balasubramani.googlepages.com" target="_blank" rel="nofollow">www.sd.balasubramani.googlepages.com</a>
Jaap Vermeer
Greenhorn

Joined: Apr 04, 2006
Posts: 16
That may not be possible with NumberFormat. You could therefore use
java.util.formatter
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38765
    
  23
That format may not be possible at all. A double number only has approx 15 sig fig precision, and the number you want to print out has 20 sig fig. You are losing 5 digits which the language cannot calculate.
I have never used the java.math.BigDecimal class, but it might be a useful "first port of call."

CR
[ April 25, 2006: Message edited by: Campbell Ritchie ]
Mohammed Yousuff
Ranch Hand

Joined: Apr 18, 2006
Posts: 45
Hi i tryed this but i getting the ans 123.456.789.012,12346 . i dont know whay the remaining is not comming . if any one knows it let me know too


Regards<br /> <br />Mohammed Yousuff M N <br /> <br />Try NOT to Become a man of SUCCESS, BUT Try to Become a man of VALUE..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regd. NumberFormat