再扩展分转元

This commit is contained in:
maxf 2019-01-02 09:20:46 +08:00
parent ccfad81f6b
commit 67d6f27cae

View File

@ -34,6 +34,25 @@ public class MoneyUtil {
return str; return str;
} }
/**
* 分转元
*
* @param num
* @return String
* @Title: formatPrice
* @Description:分转元
* @throw
*/
public static String toYuan(Long num) {
if (num == null) {
return "0.00";
}
DecimalFormat df = new DecimalFormat("0.00");
BigDecimal bigDecimal = new BigDecimal(num).divide(new BigDecimal(100));
String str = df.format(bigDecimal);
return str;
}
/** /**
* 元转分 * 元转分
* *