Here you can find the source of round(double number, double multiplier)
Parameter | Description |
---|---|
number | The input value. |
multiplier | The multiplier. |
public static double round(double number, double multiplier)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w ww . ja v a2s . c om*/ * Rounds the number of decimal places based on the given multiplier.<br> * e.g.<br> * Input: 17.5245743<br> * multiplier: 1000<br> * Output: 17.534<br> * multiplier: 10<br> * Output 17.5<br><br> * * @param number The input value. * @param multiplier The multiplier. * @return The input rounded to a number of decimal places based on the multiplier. */ public static double round(double number, double multiplier) { return Math.round(number * multiplier) / multiplier; } }