Here you can find the source of round(Number number, Number unit)
public static Number round(Number number, Number unit)
//package com.java2s; public class Main { public static Number round(Number number, Number unit) { double n = number.doubleValue(); double u = unit.doubleValue(); double r = Math.IEEEremainder(n, u); if (r < n / 2) { n -= r;/*from w w w .j a va2s . c o m*/ } else { n = n + u - r; } return new Double(n); } }