code: public static String format(final String aMessage, final String... aDetails) {
          int position = 0;
          int count = 0;
  
          while ((position = aMessage.indexOf("{}", position)) != -1) {
              position += 1;
              count += 1;
          }
  
          if (count != aDetails.length) {
              throw new IndexOutOfBoundsException(LOGGER.getI18n(MessageCodes.UTIL_043, count, aDetails.length));
          }
  
          final String[] parts = aMessage.split("\\{\\}");
          final StringBuilder builder = new StringBuilder();
  
          if (count == 1 && parts.length == 0) {
              builder.append(aDetails[0]);
          } else {
              for (int index = 0; index < parts.length; index++) {
                  builder.append(parts[index]);
  
                  if (index < aDetails.length) {
                      builder.append(aDetails[index]);
                  }
              }
          }
  
          return builder.length() == 0 ? aMessage : builder.toString();
      }
docs: Takes a <code>String</code> in the form "This is {} text {}" and replaces the <code>{}</code>s with values from
  the supplied <code>String[]</code>. The number of curly braces should be the same as the number of strings in
  the string array.
  
  @param aMessage A string that contains curly braces in the form <code>{}</code>
  @param aDetails Strings that should be put in place of the curly braces in the message string.
  @return The formatted string