docs: public static String toQuotedString(String s, char quoteChar,
                                          boolean extraQuote) {
  
          if (s == null) {
              return null;
          }
  
          int    count = extraQuote ? count(s, quoteChar)
                                    : 0;
          int    len   = s.length();
          char[] b     = new char[2 + count + len];
          int    i     = 0;
          int    j     = 0;
  
          b[j++] = quoteChar;
  
          for (; i < len; i++) {
              char c = s.charAt(i);
  
              b[j++] = c;
  
              if (extraQuote && c == quoteChar) {
                  b[j++] = c;
              }
          }
  
          b[j] = quoteChar;
  
          return new String(b);
      }