public static String joinLatin1(String separator, Collection<?> items) {
        int separatorLength = separator.length();
        int itemCount = items.size();
        if (itemCount == 0) {
            return "[]";
        }
        if (itemCount == 1) {
            Object obj = items instanceof SequencedCollection<?> collection
                    ? collection.getFirst()
                    : items.iterator()
                            .next();
            if (obj instanceof String str) {
                return "[\""
                        + str
                        + "\"";
            }
            return "["
                    + obj
                    + "]";
        }
        List<String> strings = new ArrayList<>(itemCount);
        int size = 0;
        String str;
        for (Object item : items) {
            str = item instanceof String itemStr
                    ? "\""
                            + itemStr
                            + "\""
                    : String.valueOf(item);
            size += str.length();
            strings.add(str);
        }
        size += 2 + separatorLength * (itemCount - 1);
        byte[] newStringBytes = new byte[size];
        newStringBytes[0] = '[';
        newStringBytes[size - 1] = ']';
        int writerIndex = 1;
        byte[] bytes;
        byte[] separatorBytes = getBytes(separator);
        for (int i = 0; i < itemCount; i++) {
            String s = strings.get(i);
            bytes = getBytes(s);
            System.arraycopy(bytes, 0, newStringBytes, writerIndex, bytes.length);
            writerIndex += bytes.length;
            if (i < itemCount - 1) {
                System.arraycopy(separatorBytes, 0, newStringBytes, writerIndex, separatorLength);
                writerIndex += separatorLength;
            }
        }
        return newLatin1String(newStringBytes);
    }
@implNote The method assumes the string does NOT contain any extended control character if it
          is encoded in LATIN1. Though Latin-1 is a subset of Unicode, Latin-1 and UTF-8 have
          different bit patterns.
@see <a href="https://cs.stanford.edu/people/miles/iso8859.html">iso8859</a>
turms-server-common/src/main/java/im/turms/server/common/infra/lang/StringUtil.java