Here you can find the source of RoundFractionalTons(double d)
public static double RoundFractionalTons(double d)
//package com.java2s; import java.text.DecimalFormat; public class Main { private final static DecimalFormat dft = new DecimalFormat("#.###"), dfc = new DecimalFormat("#.####"); public static double RoundFractionalTons(double d) { return Double.valueOf(dft.format(d)); }/*from w w w. j a v a 2 s . c om*/ }