src/test/java/com/stijndepestel/benchmark/SleepBenchmark.java
/**
     * Round the double value to a certain number of decimals.
     *
     * @param value
     *            The value to round.
     * @param decimals
     *            The number of decimal places to round to.
     * @return The rounded value.
     */
Round the double value to a certain number of decimals.
@param value
The value to round.
@param decimals
The number of decimal places to round to.
@return The rounded value.
Round the double value to a certain number of decimals . @param value The value to round . @param decimals The number of decimal places to round to . @return The rounded value .
public double round(final double value, final int decimals) {
        if (decimals < 0) {
            throw new IllegalArgumentException(
                    "Number of decimal places should be bigger than 0.");
        }
        BigDecimal bd = BigDecimal.valueOf(value);
        bd = bd.setScale(decimals, RoundingMode.HALF_UP);
        return bd.doubleValue();
    }
public double round ( final double value , final int decimals ) { if ( decimals < 0 ) { throw new IllegalArgumentException ( "Number of decimal places should be bigger than 0." ) ; } BigDecimal bd = BigDecimal . valueOf ( value ) ; bd = bd . setScale ( decimals , RoundingMode . HALF_UP ) ; return bd . doubleValue ( ) ; }
Round the double value to a certain number of decimals.
Round the double value to a certain number of decimals .