Here you can find the source of round(double d, int decimalPlace)
public static String round(double d, int decimalPlace)
//package com.java2s; import java.text.DecimalFormat; public class Main { public static String round(double d, int decimalPlace) { DecimalFormat df = new DecimalFormat(); df.setMaximumFractionDigits(decimalPlace); df.setMinimumFractionDigits(decimalPlace); return df.format(d); }// w w w . ja v a 2s . c o m }