public static Number parseNumber(String text, Class targetClass, NumberFormat numberFormat) {
    """
	Parse the given text into a number instance of the given target class,
	using the given NumberFormat. Trims the input <code>String</code>
	before attempting to parse the number.
	
	@param text         the text to convert
	@param targetClass  the target class to parse into
	@param numberFormat the NumberFormat to use for parsing (if <code>null</code>,
	this method falls back to <code>parseNumber(String, Class)</code>)
	@return the parsed number
	@throws IllegalArgumentException if the target class is not supported
	(i.e. not a standard Number subclass as included in the JDK)
	@see java.text.NumberFormat#parse
	@see #convertNumberToTargetClass
	@see #parseNumber(String,Class)
    """
        if (numberFormat != null) {
            try {
                Number number = numberFormat.parse(text.trim());
                return convertNumberToTargetClass(number, targetClass);
            }
            catch (ParseException ex) {
                throw new IllegalArgumentException(ex.getMessage());
            }
        } else {
            return parseNumber(text, targetClass);
        }
    }
public static Number parseNumber(String text, Class targetClass, NumberFormat numberFormat) {
        if (numberFormat != null) {
            try {
                Number number = numberFormat.parse(text.trim());
                return convertNumberToTargetClass(number, targetClass);
            }
            catch (ParseException ex) {
                throw new IllegalArgumentException(ex.getMessage());
            }
        } else {
            return parseNumber(text, targetClass);
        }
    }
public static Number parseNumber ( String text , Class targetClass , NumberFormat numberFormat ) { if ( numberFormat != null ) { try { Number number = numberFormat . parse ( text . trim ( ) ) ; return convertNumberToTargetClass ( number , targetClass ) ; } catch ( ParseException ex ) { throw new IllegalArgumentException ( ex . getMessage ( ) ) ; } } else { return parseNumber ( text , targetClass ) ; } }
Parse the given text into a number instance of the given target class,
using the given NumberFormat. Trims the input <code>String</code>
before attempting to parse the number.

@param text         the text to convert
@param targetClass  the target class to parse into
@param numberFormat the NumberFormat to use for parsing (if <code>null</code>,
this method falls back to <code>parseNumber(String, Class)</code>)
@return the parsed number
@throws IllegalArgumentException if the target class is not supported
(i.e. not a standard Number subclass as included in the JDK)
@see java.text.NumberFormat#parse
@see #convertNumberToTargetClass
@see #parseNumber(String,Class)
Parse the given text into a number instance of the given target class using the given NumberFormat . Trims the input <code > String< / code > before attempting to parse the number .