Here you can find the source of createDecimalFormatter(String pattern)
private static DecimalFormat createDecimalFormatter(String pattern)
//package com.java2s; /******************************************************************************* * Copyright (c) 2018 Arrow Electronics, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License 2.0 * which accompanies this distribution, and is available at * http://apache.org/licenses/LICENSE-2.0 * * Contributors:/*from w ww .ja v a 2 s . c om*/ * Arrow Electronics, Inc. *******************************************************************************/ import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Locale; public class Main { private static DecimalFormat createDecimalFormatter(String pattern) { DecimalFormat formatter = (DecimalFormat) NumberFormat.getCurrencyInstance(Locale.US); formatter.applyPattern(pattern); return formatter; } }