• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regd. NumberFormat

 
Balasubramani Dharmalingam
Ranch Hand
Posts: 116
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jaap Vermeer
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 47231
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic