Code example for DecimalFormat

Methods: parse, setParseBigDecimal

0
	 * @return BigDecimal 
	 * @throws java.text.ParseException  
	 */ 
	public static BigDecimal currencyToFloat(String valor) throws java.text.ParseException{
        Locale brasil = new Locale ("pt", "BR");  
        DecimalFormat df = new DecimalFormat ("#,##0.00", new DecimalFormatSymbols (brasil));  
        df.setParseBigDecimal (true);  
        BigDecimal b1 = null;
         
        try {   
            b1 = (BigDecimal) df.parse(valor);  
        } catch (ParseException ex) {   
            ex.printStackTrace();   
        }   
         
		return b1;
	} 
	 
//	public static void main(String[] args) throws java.text.ParseException { 
//		String valor = "1.234,98"; 
//		System.out.println(NumberUtil.currencyToFloat(valor));