Here you can find the source of round(double amt, int digits)
public static double round(double amt, int digits)
//package com.java2s; //License from project: Apache License public class Main { public static double round(double amt) { return ((double) Math.round(100 * amt) / 100); }/*from w ww .j a va 2s. c o m*/ public static double round(double amt, int digits) { return (Math.round(Math.pow(10, digits) * amt)) / Math.pow(10, digits); } }