Java 保持小数点后若干位的操作

	DecimalFormat df2  = new DecimalFormat("###.00");

or:

(double) (Math.round(sd3*100)/100.0); 

 

09下高一期终语文-平均分 09下期终英语-平均分 09高一下期中考试-平均分
71.66666666666667 124.0 195.66666666666666

 

=>

09下高一期终语文-平均分 09下期终英语-平均分 09高一下期中考试-平均分
71.67 124.00 195.67
This entry was posted in Java and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>