double d = 12345678; System.out.println(d); System.out.println(String.format("%.0f", d));
1.2345678E7
12345678
Note that if you only need to print this string representation, you can simply use System.out.printf("%.0f", d) .
If you don't want rounding at all, I would stick with what you suggested, namely (new BigDecimal(d)).toPlainString() .
source share