Here you can find the source of roundNumberToDouble(double value, int decimals)
public static double roundNumberToDouble(double value, int decimals)
//package com.java2s; //License from project: GNU General Public License public class Main { public static double roundNumberToDouble(double value, int decimals) { return Math.round(value * Math.pow(10, decimals)) / Math.pow(10, decimals); }// w ww. j a v a 2s. co m }