• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to convert double number into an exponential format  RSS feed

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have double value like .000000000004 and i want into format as
4.0E-11, will u help me out on this issue
Thanks in advance

Prashant
 
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you tried Double.toString( val ) ?
Bill
 
Marshal
Posts: 56605
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using J2SE5.0? If there is a 5 in your version (or a 6), you want to use the formatting options. Look up the java.util.Formatter class in the API for details.

If you are using older versions you would have to use NumberFormat and DecimalFormat classes, which are much more awkward to use.

CR
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!