This commit is contained in:
2019-01-02 15:23:40 +08:00
parent 93488c6fff
commit a639d61624
3 changed files with 26 additions and 1 deletions

View File

@@ -71,4 +71,23 @@ public class MoneyUtil {
String str = df.format(bigDecimal);
return Integer.parseInt(str);
}
/**
* 元转分
*
* @param num
* @return int
* @Title: formatPrice
* @Description: 元转分
* @throw
*/
public static Long toFen4Long(String num) {
if (num == null) {
return 0L;
}
DecimalFormat df = new DecimalFormat("#0");
BigDecimal bigDecimal = new BigDecimal(num).multiply(new BigDecimal(100));
String str = df.format(bigDecimal);
return Long.parseLong(str);
}
}