java double 转为int小数位处理
package com.qiyuan.util;
import java.math.BigDecimal;
import java.text.DecimalFormat;
public class GetIntUtil {
public static int getInt(double number){
BigDecimal bd=new BigDecimal(number).setScale(0, BigDecimal.ROUND_HALF_UP);
return Integer.parseInt(bd.toString());
}
public static int DoubleFormatInt(Double dou){
DecimalFormat df = new DecimalFormat("######0");
return Integer.parseInt(df.format(dou));
}
public static int ceilInt(double number){
return (int) Math.ceil(number);
}
private static double formatDouble1(double d) {
return (double) Math.round(d * 1000) / 1000;
}
}