double保留两位小数,返回double

double保留小数位,返回double

private Double get(){ 
	DecimalFormat df=new DecimalFormat("0.00"); 	
	double a=1.0;    
	return new Double(df.format(a).toString());
} 
private double get(){    
	DecimalFormat df=new DecimalFormat("0.00");    
	double a=1.0;    
	return Double.parseDouble(df.format(a).toString());
}

你可能感兴趣的:(note)