Here you can find the source of round(double number, int decimal)
public static BigDecimal round(double number, int decimal)
//package com.java2s; import java.math.BigDecimal; public class Main { public static BigDecimal round(double number, int decimal) { return new BigDecimal(number).setScale(decimal, BigDecimal.ROUND_HALF_UP); }// ww w .ja v a 2 s.c o m }