package com.consum.base.core.utils;
|
|
import java.math.BigDecimal;
|
|
/**
|
* 分转元工具
|
*/
|
public class CurrencyUtil {
|
|
public static BigDecimal convertFenToYuan(long price) {
|
return new BigDecimal(price).divide(new BigDecimal(100));
|
}
|
|
public static Integer convertFenToYuan(Integer price) {
|
if (price == null) {
|
return null;
|
}
|
return new BigDecimal(price).divide(new BigDecimal(100)).intValueExact();
|
}
|
|
public static BigDecimal convertFenToYuan(BigDecimal price) {
|
if (price == null) {
|
return null;
|
}
|
return price.divide(new BigDecimal(100));
|
}
|
}
|