我正在尝试打印我的号码 12386876764.34 ,我希望我的输出相同。我尝试了以下打印我的号码,但找不到打印相同的方法。请为此提供解决方案。
public static void main(String[] args) {
System.out.println((12386876764.34*100)/100);
System.out.println(Math.round(12386876764.34*100)/100);
System.out.println((new BigDecimal((12386876764.34*100)/100)).toPlainString());
System.out.println((new BigDecimal(Math.round(12386876764.34*100)/100)).toPlainString());
}
输出: 1.238687676434E10 12386876764 12386876764.340000152587890625 12386876764