package com.zjty.inspect.utils;

import java.math.BigDecimal;

/**
 * @author Mcj
 * @date 2020-03-06 16:38
 */

public class BigDecimalUtil {


    public static double get2precision(double data){
        BigDecimal bigDecimal = new BigDecimal(data);
        double value = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
        return value;
    }

    public static void main(String[] args) {
        double precision = BigDecimalUtil.get2precision(1.1111111D);
        System.out.println(precision);
    }
}
