[Edit]
+
0
-
0
Java - remove trailing zeros from double (while printing)
1 2 3 4 5 6 7// import java.text.DecimalFormat; DecimalFormat format = new DecimalFormat("0.#################"); System.out.println(format.format(0.0)); // 0 System.out.println(format.format(1.0)); // 1 System.out.println(format.format(2.0)); // 2