Here you can find the source of getBigDecimal(String value)
public static BigDecimal getBigDecimal(String value)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static BigDecimal getBigDecimal(String value) { BigDecimal result = null; if (value != null) { try { result = BigDecimal.valueOf(Double.valueOf(value)); } catch (Exception ignored) { }/* ww w . j a va 2s. c o m*/ } return result; } public static BigDecimal getBigDecimal(String value, String pattern) { BigDecimal result = null; assert value != null : "[DSU] invalid value : " + value; if (value != null) { Matcher m = Pattern.compile(pattern).matcher(value.trim()); if (m.matches()) { result = getBigDecimal(m.group(1)); } } return result; } }