In your string formatting example you're not rounding the number you're just taking the first two decimal places.
(在您的字符串格式示例中,您没有舍入仅将小数点后两位放在首位的数字。)
So your code drops the .005 and keeps the .69 (因此,您的代码会删除.005并保留.69)
If .70 is the desired result then DecimalFormat sounds correct to me
(如果.70是所需的结果,那么DecimalFormat对我来说听起来正确)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…