static int calcTimeoutMsRemainingAsInt(long now, long deadlineMs) {
        long deltaMs = deadlineMs - now;
        if (deltaMs > Integer.MAX_VALUE)
            deltaMs = Integer.MAX_VALUE;
        else if (deltaMs < Integer.MIN_VALUE)
            deltaMs = Integer.MIN_VALUE;
        return (int) deltaMs;
    }
Get the current time remaining before a deadline as an integer.

@param now           The current time in milliseconds.
@param deadlineMs    The deadline time in milliseconds.
@return              The time delta in milliseconds.
clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java