只要将在运算结果用float()强转即可
例如
public static String txfloat(int a,int b) {
// TODO 自动生成的方法存根
DecimalFormat df=new DecimalFormat("0.00");//设置保留位数
return df.format((float)a/b);
}
只要将在运算结果用float()强转即可
例如
public static String txfloat(int a,int b) {
// TODO 自动生成的方法存根
DecimalFormat df=new DecimalFormat("0.00");//设置保留位数
return df.format((float)a/b);
}