How to print a double in standard instead of scientific notation?

Rid*_*ris -3 java

How can I print a double in standard notation?

double h = 104857600 - 32;
System.out.println(h);
Run Code Online (Sandbox Code Playgroud)

Result:

1.04857568E8
Run Code Online (Sandbox Code Playgroud)

Desired result:

104857568
Run Code Online (Sandbox Code Playgroud)

Chr*_*ian 6

You can use printf()

System.out.printf("%.0f", h);
Run Code Online (Sandbox Code Playgroud)

The 0 is the precision, you can modify it.

Edit:

If you want to store it as a String, you can use String.format("%.0f", h).

  • @ user2818462请停止将此作为绝对值.[绝对值](http://en.wikipedia.org/wiki/Absolute_value)完全不同. (2认同)