/** * Converts the specified object to a number and returns * a formatted string representing that number in the specified * {@link Locale}. * * @param format the custom or standard pattern to be used * @param obj the number object to be formatted * @param locale the {@link Locale} to be used when formatting * @return a formatted string representing the specified number or * <code>null</code> if the parameters are invalid */ public String format(String format, Object obj, Locale locale) { Number number = toNumber(obj); NumberFormat nf = getNumberFormat(format, locale); if (number == null || nf == null) { return null; } return nf.format(number); }