Code example for DecimalFormat

Methods: setParseBigDecimal, setRoundingMode

0
    { 
      throw new NullPointerException();
    } 
    this.pattern = pattern;
    this.locale = locale;
    this.decimalFormat = new DecimalFormat(pattern, new DecimalFormatSymbols(locale));
    this.decimalFormat.setParseBigDecimal(true);
    this.decimalFormat.setRoundingMode(RoundingMode.HALF_UP);
 
  } 
 
  /** 
   * Creates a new number-format for the given type using the standard JDK methods. 
   * 
   * @param type   the type. 
   * @param locale the locale for which the format shoudl be created. 
   * @return the number format or null, if there was an error while creating the format. 
   */ 
  private NumberFormat createFormat(final int type, final Locale locale)
  { 
    switch (type)