Java Double Number Round round(double value, double factor)

Here you can find the source of round(double value, double factor)

Description

Round the value to the nearest factor.

License

Open Source License

Parameter

Parameter Description
value The value to round.
factor The factor of where to round.

Return

The rounded value.

Declaration

public static double round(double value, double factor) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from   w ww  . j av  a2 s . co m*/
     * Round the value to the nearest factor.
     *
     * @param value  The value to round.
     * @param factor The factor of where to round.
     * @return The rounded value.
     */
    public static double round(double value, double factor) {
        return (Math.round(value / factor) * factor);
    }
}

Related

  1. round(double value)
  2. round(double value)
  3. round(double value)
  4. round(double value)
  5. round(double value, double decimalplaces)
  6. round(double value, double increment)
  7. round(double value, double precision)
  8. round(double value, int decimal)
  9. round(double value, int decimal)