Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can floating point values be printed without mantissa/exponent format?

Tags:

java

I am trying to print a double value. It is printing in matissa and exponent format, which is not what I want. For example, my program prints 1.234567E6 for the value 1243567. How can I make it print 1234657?

like image 617
GuruKulki Avatar asked Jun 09 '10 18:06

GuruKulki


2 Answers

BigDecimal.valueOf(double).toPlainString();
like image 80
barwnikk Avatar answered Oct 06 '22 13:10

barwnikk


You might look into the NumberFormat class and the DecimalFormat.

like image 29
VeeArr Avatar answered Oct 06 '22 12:10

VeeArr