Here you can find the source of round(double number, int decimal)
public static double round(double number, int decimal)
//package com.java2s; //License from project: Open Source License public class Main { public static double round(double number, int decimal) { return Math.round(number * Math.pow(10, decimal)) / Math.pow(10, decimal); }/*from w w w. j ava 2s.c o m*/ }