Here you can find the source of round(double a, double precision)
Parameter | Description |
---|---|
a | Value |
precision | Precision |
public static double round(double a, double precision)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w.j a v a2 s . com*/ * Mathematically rounds a number with a defined precision. * * @param a Value * @param precision Precision * @return Rounded value */ public static double round(double a, double precision) { if (precision == 0.0) { return 0.0; } return Math.round(a / precision) * precision; } }