code: static String format(String template, Object... args) {
          template = String.valueOf(template); // null -> "null"
  
          if (N.isNullOrEmpty(args)) {
              return template;
          }
  
          // start substituting the arguments into the '%s' placeholders
          final StringBuilder sb = Objectory.createStringBuilder(template.length() + 16 * args.length);
          int templateStart = 0;
          int i = 0;
  
          String placeholder = "{}";
          int placeholderStart = template.indexOf(placeholder);
  
          if (placeholderStart < 0) {
              placeholder = "%s";
              placeholderStart = template.indexOf(placeholder);
          }
  
          while (placeholderStart >= 0 && i < args.length) {
              sb.append(template, templateStart, placeholderStart);
              sb.append(N.toString(args[i++]));
              templateStart = placeholderStart + 2;
              placeholderStart = template.indexOf(placeholder, templateStart);
          }
  
          sb.append(template, templateStart, template.length());
  
          // if we run out of placeholders, append the extra args in square braces
          if (i < args.length) {
              sb.append(" [");
              sb.append(N.toString(args[i++]));
              while (i < args.length) {
                  sb.append(", ");
                  sb.append(N.toString(args[i++]));
              }
              sb.append(']');
          }
  
          final String result = sb.toString();
  
          Objectory.recycle(sb);
  
          return result;
      }
docs: Note that this is somewhat-improperly used from Verify.java as well.