class ApiUtils {

    public static long validateMillisecondDuration(final Duration duration, final String messagePrefix) {
        try {
            if (duration == null) {
                throw new IllegalArgumentException(messagePrefix + VALIDATE_MILLISECOND_NULL_SUFFIX);
            }

            return duration.toMillis();
        } catch (final ArithmeticException e) {
            throw new IllegalArgumentException(messagePrefix + VALIDATE_MILLISECOND_OVERFLOW_SUFFIX, e);
        }
    }

    private  ApiUtils();

}