Here you can find the source of round(double d, int precision)
private static double round(double d, int precision)
//package com.java2s; public class Main { private static double round(double d, int precision) { int temp = (int) ((d * Math.pow(10, precision))); return (((double) temp) / Math.pow(10, precision)); }/* ww w . j a va 2 s . c om*/ }