Here you can find the source of getNumberFormatter(final String format)
private static DecimalFormat getNumberFormatter(final String format)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.text.DecimalFormat; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class Main { private static Map<String, ThreadLocal<DecimalFormat>> decimalFormatters = new ConcurrentHashMap<String, ThreadLocal<DecimalFormat>>(); private static DecimalFormat getNumberFormatter(final String format) { ThreadLocal<DecimalFormat> threadLocal = decimalFormatters.get(format); if (threadLocal == null) { threadLocal = new ThreadLocal<DecimalFormat>() { @Override//from w ww . ja v a2 s . c o m protected DecimalFormat initialValue() { return new DecimalFormat(format); } }; decimalFormatters.put(format, threadLocal); } return threadLocal.get(); } }