Here you can find the source of round(double x)
public static double round(double x)
//package com.java2s; //License from project: Apache License public class Main { public static double round(double x) { return round(x, 1); }// w w w .j a v a 2 s.c om public static double round(double x, int places) { double factor = Math.pow(10, places); return Math.round(factor * x) / factor; } }