Here you can find the source of roundNumber(double theNumber, int places)
public static double roundNumber(double theNumber, int places)
//package com.java2s; //License from project: Open Source License public class Main { public static double roundNumber(double theNumber, int places) { double placesDouble = Math.pow(10, places); return Math.round(theNumber * placesDouble) / placesDouble; }/*w w w. ja v a2 s .co m*/ }