欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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);
				}