package com.changfa.utils;

import javax.servlet.http.HttpServletRequest;
import java.text.NumberFormat;

public class PrecentUtil {

    public static String getPrecent(Integer a ,Integer b) {
        NumberFormat numberformat=NumberFormat.getInstance();
        numberformat.setMaximumFractionDigits(2);
        String result1=numberformat.format((float)a/(float)b*100);
        System.out.println(result1+"%");

        java.text.DecimalFormat df=new java.text.DecimalFormat("##.##%");//传入格式模板
        String result2=df.format((float)a/(float)b);
        return result2;
    }
}
