Here you can find the source of getDoubledigit(double f)
public static double getDoubledigit(double f)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { public static double getDoubledigit(double f) { DecimalFormat df = new DecimalFormat("#####.00"); return Double.parseDouble(df.format(f)); }//from ww w . ja va 2 s . c o m public static Double parseDouble(String str) { try { DecimalFormat df = new DecimalFormat("#,##0.0#"); return Double.valueOf(String.valueOf(df.parseObject(str))); } catch (Exception e) { return new Double(0.0); } } }