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