• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Regd. NumberFormat  RSS feed

 
Ranch Hand
Posts: 116
  • 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.
 
Greenhorn
Posts: 16
  • 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
 
Marshal
Posts: 60168
188
  • 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 ]
 
Ranch Hand
Posts: 45
  • 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
Boost this thread!