public static int saturatedCast(final long value) {
        return value > Integer.MAX_VALUE ? Integer.MAX_VALUE : value < Integer.MIN_VALUE ? Integer.MIN_VALUE
            : (int) value;
    }
Returns the {@code int} nearest in value to {@code value}.
jraft-core/src/main/java/com/alipay/sofa/jraft/util/Ints.java