1     public static Double twoPoint(double temp){
 2         String strNum = String.valueOf(temp);
 3         String ss= "";
 4         int a = strNum.indexOf(".");
 5         if(a>0){
 6             //获取小数点后面的数字
 7             String dianAfter = strNum.substring(a+1);
 8             if(dianAfter.length()>=2){
 9                 ss=strNum.substring(0,a+3);
10             }else {
11                 ss = strNum+"0";
12             }
13         }else{
14             ss=strNum+".00";
15         }
16         return Double.parseDouble(ss);
17     }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2021-10-19
  • 2022-12-23
  • 2022-01-11
  • 2021-11-18
猜你喜欢
  • 2022-12-23
  • 2021-10-19
  • 2021-09-27
  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案