Here you can find the source of format(double price)
public static String format(double price)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { public static String format(double price) { DecimalFormat formatter = new DecimalFormat("###,###,##0.00"); return formatter.format(price); }/*from ww w. j a v a2 s . c om*/ public static String format(Object price) { DecimalFormat formatter = new DecimalFormat("###,###,##0.00"); return formatter.format(price); } }