print a float number with 3 digits following

just use the java's printf function. It is like C's printf.

System.out.printf("%.3f\n", x);

 

posted @ 2014-12-20 09:48  zmiao  阅读(105)  评论(0编辑  收藏  举报