java.text.DecimalFormat df=new DecimalFormat("0.##");double d=3.14159System.out.println(df.format(d));//输出3.14