This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes how to convert  double number into  an exponential format Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "how to convert  double number into  an exponential format " Watch "how to convert  double number into  an exponential format " New topic
Author

how to convert double number into an exponential format

prashant gour
Ranch Hand

Joined: Feb 07, 2006
Posts: 45
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
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12325
    
    1
have you tried Double.toString( val ) ?
Bill
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32833
    
    4
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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: how to convert double number into an exponential format
 
Similar Threads
Using return
double value formatting ...
Is it possible to reformat the output from a double value?
Actual parameter checking
format double