Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

number formating

 
Benjamin Samuel
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having a double value
e.g. a)99558669546.
b)0.00125

I have to convert these values into String. I need to read the value as-is without any truncation or formatting. For E.g. i do not want 'a'
to be formatted in Exponential format (like E9) and i dont want 'b' to be truncated to 0.001 while converting to String.

How can I achieve this using NumberFormat class or is there any other class through which this can be achieved?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please do not post the same question to multiple forums. Read this for why I deleted the other copies of your post.
 
Bill Shirley
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn't give us an example of how you want to use this as a string.

Try the docs for System.out.printf().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic