private static int getCodepoint(byte[] bytes, int firstByteIndex) {
        byte firstByte = bytes[firstByteIndex];
        if ((firstByte & 0x80) == 0) {
            // ASCII character
            return firstByte;
        } else if ((firstByte & 0xE0) == 0xC0) {
            // Two-byte UTF-8 character
            return ((firstByte & 0x1F) << 6) | (bytes[firstByteIndex + 1] & 0x3F);
        } else if ((firstByte & 0xF0) == 0xE0) {
            // Three-byte UTF-8 character
            return ((firstByte & 0x0F) << 12) | ((bytes[firstByteIndex + 1] & 0x3F) << 6)
                    | (bytes[firstByteIndex + 2] & 0x3F);
        } else if ((firstByte & 0xF8) == 0xF0) {
            // Four-byte UTF-8 character
            return ((firstByte & 0x07) << 18) | ((bytes[firstByteIndex + 1] & 0x3F) << 12)
                    | ((bytes[firstByteIndex + 2] & 0x3F) << 6)
                    | (bytes[firstByteIndex + 3] & 0x3F);
        } else {
            throw new IllegalStateException("Invalid UTF-8 byte sequence");
        }
    }
@see java.nio.charset.CharsetEncoder#maxBytesPerChar()
turms-server-common/src/main/java/im/turms/server/common/infra/lang/Utf8String.java