Here you can find the source of comma(long n)
public static final String comma(long n)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; import java.text.NumberFormat; public class Main { private static final ThreadLocal<NumberFormat> numberFormat = new ThreadLocal<NumberFormat>() { @Override/*from www . j a v a2 s . c o m*/ protected NumberFormat initialValue() { return new DecimalFormat(); } }; /** Copied from com.shopwiki.text.Pretty */ public static final String comma(long n) { return numberFormat.get().format(n); } /** Copied from com.shopwiki.text.Pretty */ public static final String comma(double n) { return numberFormat.get().format(n); } }