Here you can find the source of to3DP(double number)
public static double to3DP(double number)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { private static final DecimalFormat FORMAT = new DecimalFormat("#.####"); public static double to3DP(double number) { return Double.valueOf(FORMAT.format(number)); }//w w w. j a v a2s . c om }