Here you can find the source of round(int t, int n, int decimals)
public static double round(int t, int n, int decimals)
//package com.java2s; //License from project: Open Source License public class Main { public static double round(int t, int n, int decimals) { double exp = Math.pow(10, decimals); return Math.round(exp * t / n) / exp; }/*from w w w . j a va 2s . co m*/ public static double round(double d, int decimals) { double exp = Math.pow(10, decimals); return Math.round(exp * d) / exp; } }