code: public static final String format(final String format, final Object... params)
      {
          final StringBuilder b = new StringBuilder();
  
          int p = 0;
  
          while (true)
          {
              final int i = format.indexOf('{', p);
  
              if (i == -1)
              {
                  break;// done
              }
              final int i2 = format.indexOf('}', i + 1);
  
              if (i2 == -1)
              {
                  break;// done
              }
              if (p != i)
              {
                  b.append(format.substring(p, i));
              }
              final String nstr = format.substring(i + 1, i2);
  
              try
              {
                  final int n = Integer.parseInt(nstr);
  
                  if ((n >= 0) && (n < params.length))
                  {
                      b.append(params[n]);
                  }
                  else
                  {
                      b.append('{').append(nstr).append('}');
                  }
              }
              catch (final NumberFormatException e)
              {
                  b.append('{').append(nstr).append('}');
              }
              p = i2 + 1;
          }
          b.append(format.substring(p));
  
          return b.toString();
      }
docs: Simple formatter. Replaces strings of the form "{0}", "{1}" etc. with the
  corresponding parameters.
  
  @param format String with "{0}", "{1}" placeholders.
  @param params First parameter will be placed in "{0}" placeholder.
  
  @return Formatted string