Code example for DecimalFormat

Methods: setParseBigDecimalparse

0
    } 
 
    @Override 
    public BigDecimal getNumber(String string) {
        DecimalFormat format = (DecimalFormat) DecimalFormat.getNumberInstance(locale);
        format.setParseBigDecimal(true);
        try { 
            return (BigDecimal) format.parse(string);
        } catch (ParseException e) {
            throw new RuntimeException("Couldn't parse " + string, e);
        } 
    } 
 
    @Override 
    public Character getDecimalSeparator() {
        return ((DecimalFormat) DecimalFormat.getNumberInstance(locale)).getDecimalFormatSymbols().getDecimalSeparator();
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE