如 double d=0.00751953125;
取前四位后d=0.0075
------解决方案--------------------
public static double round(double d, int n) {
d = d * Math.pow(10, n);
d = Math.round(d);
return d / Math.pow(10, n);
}
------解决方案--------------------
Double d = 0.00751953125;
DecimalFormat df = new DecimalFormat( "###,###.0000 ");
System.out.println(df.format(d));
------解决方案--------------------
public Double Round(Double d,int scale){
BigDecimal big = new BigDecimal(d);
return big.setScale(scale,BigDecimal.ROUND_HALF_UP).doubleValue();
}