📜  java double 到字符串固定精度 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:26.491000             🧑  作者: Mango

代码示例1
Double toBeTruncated = new Double("3.5789055");

Double truncatedDouble = BigDecimal.valueOf(toBeTruncated)
    .setScale(3, RoundingMode.HALF_UP)
    .doubleValue();