62,620
社区成员
发帖
与我相关
我的任务
分享
public static String round(String v, int string, int scale) {
if (scale < 0) {
throw new IllegalArgumentException(
"The scale must be a positive integer or zero");
}
BigDecimal b = new BigDecimal(v);
BigDecimal one = new BigDecimal(string);
return String.valueOf(b.divide(one, scale, BigDecimal.ROUND_HALF_UP));
}