-1

When I enter the number 0.0007575 on the double, the result will be "7.575E-4", but I want result 0.0007575

thanks

nazanin
  • 729
  • 1
  • 6
  • 13
  • It's the same value but is displayed (somewhere) in exponential notation format. Please update with some code to show where the value is not displayed as expected. – Andrew S Oct 02 '18 at 15:45

1 Answers1

1

Use a custom DecimalFormat to format the double value:

DecimalFormat fmt = new DecimalFormat("#0.000"); // leading zero and 3 fraction digits
String result = fmt.format(11.123456789);
System.out.println(result); // 11.123
Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111