Java保留两位小数

 

 

import java.text.DecimalFormat;//导入包

//保留2位小数
int    scoreAvg = 17.234
DecimalFormat df = new DecimalFormat(".00");
System.out.println(df.format(scoreAvg));

 

posted on 2019-09-21 09:40  婧星  阅读(696)  评论(0编辑  收藏  举报

导航