Code example for MessageFormat

Methods: format

        return get(key, Locale.getDefault(), args);
    public String get(String key, Locale locale, Object... args) {
        String pattern = messages.getString(key);
        MessageFormat formatter = new MessageFormat(pattern);
        String message = formatter.format(args);
        try { 
            return new String(message.getBytes("ISO-8859-1"), "UTF-8");
        } catch (UnsupportedEncodingException e) {
            return message;
    public static FormattingMessageBundle getBundle(String name) {
        return new FormattingMessageBundle(ResourceBundle.getBundle(name));
Connect your IDE to all the code out there  Get Codota for Java