code: public static int toIntExact(long value) {
          if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) {
              throw new ArithmeticException("integer overflow");
          }
  
          return (int) value;
      }
docs: Returns the value of the {@code long} argument; throwing an exception if the value overflows an {@code int}.
  
  @param value the long value
  @return the argument as an int
  @throws ArithmeticException if the {@code argument} overflows an int