mirror of
https://gitee.com/jzsw-it/yexuejc-base.git
synced 2025-06-07 06:14:04 +08:00
再扩展分转元
This commit is contained in:
parent
ccfad81f6b
commit
67d6f27cae
@ -34,6 +34,25 @@ public class MoneyUtil {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 元转分
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user