package com.huimv.admin.common.utils;

import java.text.DecimalFormat;

/**
 * @Author : yuxuexuan
 * @Create : 2021/11/29 0029 10:52
 **/
public class PercentUtil {

    public static String getGrowth(Double lastMonth,Double lastTwoMonth){
        if (lastMonth.equals( lastTwoMonth)){
            return "0";
        }
        if (lastMonth == 0.0){
            return "-100";
        }

        if (lastTwoMonth == 0.0){
            return "100";
        }
        DecimalFormat df = new DecimalFormat("0.00");

        return df.format((lastMonth - lastTwoMonth)/ lastTwoMonth *100);
    }



}
