Java tutorial
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; import java.text.NumberFormat; public class Main { private static final String FORMAT_WITH_DECIMAL = "###,###.###"; public static String formatWithDecimal(String price) { return formatWithDecimal(Double.parseDouble(price)); } public static String formatWithDecimal(double price) { NumberFormat formatter = new DecimalFormat(FORMAT_WITH_DECIMAL); return formatter.format(price); } }