Numeric.java [src/csip/utils] Revision:   Date:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package csip.utils;

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

/**
 * Numeric utilities.
 *
 * @author od
 */
public class Numeric {

  /**
   * round a double and keep it a double
   *
   * @param value the value to round
   * @param places the number of decimal places
   * @return the rounded value.
   */
  public static double round(double value, int places) {
    return new BigDecimal(value).setScale(places, RoundingMode.HALF_UP).doubleValue();
  }

}