Integer a1 = 1; Integer b1= 3; String passRatio = String.format("%.2f",((a1.doubleValue() / b1.doubleValue())*100));
其中format的第一个参数是保留几位小数,2f则是保留两位小数。