void (MessageFormat format) { Format[] formats = format.getFormats(); NumberFormat ordinal = null; for (int i = 0; i < formats.length; i++) { Format element = formats[i]; if (element instanceof DecimalFormat && "ordinal".equals(((DecimalFormat)element).getPositivePrefix())) { if (ordinal == null) ordinal = getOrdinalFormat(format.getLocale()); format.setFormat(i, ordinal); } } }