• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regd. NumberFormat

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..?




Output:
123.456.789.012,123

Expected output:
123.456.789.012,12345678

Thanks in advance.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are methods in the NumberFormat API to change the minimum/maximum integer and fraction digits displayed.
 
Balasubramani Dharmalingam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried the following code but still not able to get expected answer.

Code:
NumberFormat df = NumberFormat.getNumberInstance(Locale.ITALIAN) ;
df.setMaximumFractionDigits( 8 ) ;
System.out.println( df.format( 123456789012.12345678 ) ) ;

Output:
123.456.789.012,12346

Expected ouput:
123.456.789.012,1234678
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This may not be a formatting issue... 18 digits may exceed the precision that can be provided by a double.

Henry
 
reply
    Bookmark Topic Watch Topic
  • New Topic