Java控制double类型的精度 DecimalFormat df=new DecimalFormat("0.0000"); System.out.println(df.format(Math.random()));