Java tutorial
import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; public class Main { public static void main(String args[]) { double d = 123456.7890; DecimalFormat df = new DecimalFormat("#####0.00"); DecimalFormatSymbols dfs = df.getDecimalFormatSymbols(); dfs.setDecimalSeparator('.'); df.setDecimalFormatSymbols(dfs); System.out.println(df.format(d)); } }