Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conversion from exponential form to decimal in Java

Tags:

java

I want to convert exponential to decimal. e.g. 1.234E3 to 1234.

like image 993
sai Avatar asked Dec 01 '09 13:12

sai


1 Answers

It is not really a conversion, but about how you display the number. You can use NumberFormat to specify how the number should be displayed.

Check the difference:

double number = 100550000.75;
NumberFormat formatter = new DecimalFormat("#0.00");

System.out.println(number);
System.out.println(formatter.format(number));
like image 123
b.roth Avatar answered Oct 06 '22 07:10

b.roth