保留n位小数

String.format("%.2f", num)

那个2换成几就是保留几位小数

原文地址:https://www.cnblogs.com/IceBlueBrother/p/12054424.html