Here you can find the source of getBigDecimalFromString(String numericValue, String numberFormat)
public static BigDecimal getBigDecimalFromString(String numericValue, String numberFormat) throws ParseException
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.ParseException; public class Main { public static BigDecimal getBigDecimalFromString(String numericValue, String numberFormat) throws ParseException { DecimalFormatSymbols symbols = new DecimalFormatSymbols(); symbols.setGroupingSeparator(numberFormat.charAt(0)); symbols.setDecimalSeparator(numberFormat.charAt(1)); DecimalFormat formatter = new DecimalFormat(); formatter.setDecimalFormatSymbols(symbols); formatter.setGroupingSize(3);//from w w w.j a va 2 s . co m formatter.setMinimumIntegerDigits(1); formatter.setMaximumIntegerDigits(Integer.MAX_VALUE); return new BigDecimal(formatter.parse(numericValue).toString()); } }