code: public static String lenientFormat(String template, Object... args) {
          template = String.valueOf(template); // null -> "null"
  
          if (args == null) {
              args = new Object[] { "(Object[])null" };
          } else {
              for (int i = 0; i < args.length; i++) {
                  args[i] = lenientToString(args[i]);
              }
          }
  
          // start substituting the arguments into the '%s' placeholders
          final StringBuilder sb = Objectory.createStringBuilder(template.length() + 16 * args.length);
          int templateStart = 0;
          int i = 0;
          while (i < args.length) {
              int placeholderStart = template.indexOf("%s", templateStart);
              if (placeholderStart == -1) {
                  break;
              }
              sb.append(template, templateStart, placeholderStart);
              sb.append(args[i++]);
              templateStart = placeholderStart + 2;
          }
          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(args[i++]);
              while (i < args.length) {
                  sb.append(", ");
                  sb.append(args[i++]);
              }
              sb.append(']');
          }
  
          final String result = sb.toString();
          Objectory.recycle(sb);
          return result;
      }
docs: TODO(diamondm) consider using Arrays.toString() for array parameters