Java tutorial
//package com.java2s; import java.text.DecimalFormat; public class Main { static private DecimalFormat doubleFormat = new DecimalFormat(); public static Double Doubleformat(DecimalFormat df, Double value) { if (value == null || value.compareTo(0.0) == 0) { return 0.0; } if (df == null) { df = doubleFormat; } String dfValue = df.format(value); dfValue = dfValue.replaceAll("[ ]", ""); dfValue = dfValue.replaceAll("[,]", ""); return Double.valueOf(dfValue); } }