Java tutorial
//package com.java2s; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Locale; public class Main { public static String getVersionString(final double price) { final NumberFormat nf = NumberFormat.getNumberInstance(Locale.US); final DecimalFormat df = (DecimalFormat) nf; df.applyPattern("###,###.####"); final String output = df.format(price); return output; } }