/**
* 返回整数 积分
* @param price
* @param tmp 比率值
* @return
*/
public static Integer getIntegerFormat(Integer price,Float tmp) {
Integer returnValue = 0;
if(price !=null && tmp != null && tmp !=0) {
NumberFormat numberFormat = new DecimalFormat("#0");
returnValue = Integer.parseInt(numberFormat.format(price*0.01/tmp));
}
return returnValue;
}
/**
* 返回格式化比率
* @param price
* @param tmp 积分
* @return
*/
public static String getStringFormat(Integer price,Integer tmp) {
return getStringFormat(price,tmp,"#0.0000");
}
public static String getStringFormat(Integer price,Integer tmp,String pattern) {
NumberFormat format = new DecimalFormat(pattern);
return format.format(price*0.01/tmp);
}