//抹零
public static double zeroRemove(int type,double sourceMoney,double zeroMoney){
//角分抹零
if(type == 1){
return Double.valueOf(sourceMoney).intValue();
}else if(type == 2){
//xxx金额一下抹零
if(sourceMoney < zeroMoney){
return 0;
}
int zerolen = String.format(“%.2f”,zeroMoney).length();
double zeroMoneyPartOfSouceMoney = Double.valueOf(StringUtils.right(String.format(“%.2f”,sourceMoney) + “”,zerolen));
String nonZeroMoneyPartOfSouceMoney = “”;
if (String.format(“%.2f”, sourceMoney).length() > zerolen) {
nonZeroMoneyPartOfSouceMoney = StringUtils.left(String.format(“%.2f”, sourceMoney) + “”, String.format(“%.2f”, sourceMoney).length() - zerolen);
}
if(zeroMoneyPartOfSouceMoney < zeroMoney) {
//抹掉
return Double.valueOf( nonZeroMoneyPartOfSouceMoney + (zeroMoney + “”).replaceAll(“\d”,”0”));
}else{
//不用抹零
return sourceMoney;
}
/if(zeroMoney > 1) {
}else{
//暂不处理
return sourceMoney;
}/
}
return sourceMoney;
}