public static long getLong(final Map<String, Object> configs, final String key) {
        final Object value = configs.get(key);
        if (value == null) {
            throw new NoSuchElementException("Missing required configuration '" + key + "'");
        }
        if (value instanceof Number) {
            return ((Number) value).longValue();
        } else if (value instanceof String) {
            return Long.parseLong((String) value);
        }
        throw new IllegalArgumentException("Invalid value (" + value + ") on configuration '" + key + "'. Please specify a long value.");
    }
Finds and returns a long configuration option from the configuration map

@param configs Map with the configuration options
@param key Configuration option for which the long value will be returned
@return A long value of the configuration option
@throws NumberFormatException if the configuration option is not a valid long
@throws NoSuchElementException if the configuration option is not set
@throws IllegalArgumentException if the configuration option is not a long or a string
clients/src/main/java/org/apache/kafka/common/utils/ConfigUtils.java