package com.jasamedika.medifirst2000.util;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * @author salmanoe
 * @since Dec 29, 2021
 */
public class MathUtil {

	public MathUtil() {
		super();
	}

	public static double round(double value, int places) {
		if (places < 0)
			throw new IllegalArgumentException();

		BigDecimal bd = BigDecimal.valueOf(value);
		bd = bd.setScale(places, RoundingMode.HALF_UP);

		return bd.doubleValue();
	}

}
