package cn.freemud.utils;

import java.math.BigDecimal;

public class MoneyUtils {

    public static String parseFen2Yuan(Long fen) {
        if(null == fen) {
            return "0";
        }
        return new BigDecimal(fen).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toPlainString();
    }

    public static String parseFen2Yuan(Integer fen) {
        if(null == fen) {
            return "0";
        }
        return new BigDecimal(fen).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toPlainString();
    }

    public static String parseFen2YuanInt(Long fen) {
        if(null == fen) {
            return "0";
        }
        return new BigDecimal(fen).divide(new BigDecimal(100), 0, BigDecimal.ROUND_HALF_UP).toPlainString();
    }

    public static String parseFen2YuanInt(Integer fen) {
        if(null == fen) {
            return "0";
        }
        return new BigDecimal(fen).divide(new BigDecimal(100), 0, BigDecimal.ROUND_HALF_UP).toPlainString();
    }
}
