1.利用正则表达式可以保留任意位数
//double保留一位小数
public double oneAfterPoint(double d){
String strD = String.valueOf(d*10);
String[] strArr = strD.split("\\.");
return Double.parseDouble(strArr[0])/10;
}
2.public static double formartDouble(double d){
double d = new BigDecimal(avgNmber).setScale(1, RoundingMode.UP).doubleValue()
}
3.get_double = Double.ParseDouble(String.format(
"%.2f"
,result_value));