Java中String转换Double类型
double num1 = 0.0;
String qq = "19.987";
num1 = Double.valueOf(qq.toString());
Java小数点后留两位
double num1 =11;
double num1 =21;
String num1 ="";
DecimalFormat df = new DecimalFormat(".00");
num3 = df.format((num1 - num2)/num2*100);
Sytem.out.println(num3);
运行结果:
num3=52.38