Here you can find the source of formatDouble(double orig)
public static double formatDouble(double orig)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; public class Main { public static double formatDouble(double orig) { DecimalFormat df = new DecimalFormat("######0.000"); return Double.valueOf(df.format(orig)).doubleValue(); }// w ww . j a v a2s . c o m }