Here you can find the source of round(double dValue)
public static double round(double dValue)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.text.NumberFormat; public class Main { public static double round(double dValue) { NumberFormat currencyFormat = NumberFormat.getCurrencyInstance(); double fractionMultiplier = Math.pow(10.0, currencyFormat.getMaximumFractionDigits()); return Math.rint(dValue * fractionMultiplier) / fractionMultiplier; }// ww w . j av a2 s. c om }