double取小数点后一位
程序员文章站
2022-06-01 21:31:10
...
if(checkVal == null){
checkVal = "d";
}
if(checkVal.equals("b") || checkVal.equals("b,c") || checkVal.equals("a,b") || checkVal.equals("a,b,c")){
double ywp = paperScores.getDoubleValue("1");
String yvwen = jstuScore.getString("1");
JSONObject jywscore = JSON.parseObject(yvwen);
String ywscore = "";
if(yvwen == null){
ywscore = "0";
}else{
ywscore = (jywscore.getString("stuScore")).toString();
}
double ywf = Double.valueOf(ywscore);
double yws = (ywf/ywp)*100;
BigDecimal bid = new BigDecimal(yws);
double yws1 = bid.setScale(1,BigDecimal.ROUND_HALF_UP).doubleValue();
if(yvwen != null){
jywscore.put("stuScore", yws1+"");
jstuScore.put("1", jywscore);
jStuScore.put("stuXkScoreAndRank", jstuScore);
}
上一篇: 统计0到1亿中1出现的个数