java (beginner) converting scientific notation to decimal

hibc picture hibc · Oct 25, 2012 · Viewed 14.5k times · Source

if

double d =  1.999e-4

I want my output to be 0.0001999.

How can I do it?

Answer

RP- picture RP- · Oct 25, 2012
NumberFormat formatter = new DecimalFormat("###.#####");  

String f = formatter.format(d);  

You can explore the sub classes of NumberFormat class to know more details.