public static List<Integer> encode(String modelName, String text) {
        if (isBlank(text)) {
            return new ArrayList<>();
        }
        Encoding enc = getEncoding(modelName);
        if (Objects.isNull(enc)) {
            return new ArrayList<>();
        }
        List<Integer> encoded = enc.encode(text);
        return encoded;
    }
Get the encoded array by model name using encode.

@param text Text information
@return Encoding array
api/src/main/java/com/theokanning/openai/utils/TikTokensUtil.java