leanback/src/main/java/androidx/leanback/util/MathUtil.java
public static int safeLongToInt(long numLong) {
        if ((int) numLong != numLong) {
            throw new ArithmeticException("Input overflows int.\n");
        }
        return (int) numLong;
    }
/**
     * Convert long to int safely. Similar with Math.toIntExact() in Java 8.
     * @param numLong Number of type long to convert.
     * @return int version of input.
     * @throws ArithmeticException If input overflows int.
     */
Convert long to int safely. Similar with Math.toIntExact() in Java 8.
@param numLong Number of type long to convert.
@return int version of input.
@throws ArithmeticException If input overflows int.
Convert long to int safely . Similar with Math . toIntExact () in Java 8 . @param numLong Number of type long to convert . @return int version of input . @throws ArithmeticException If input overflows int .
public static int safeLongToInt(long numLong) {
        if ((int) numLong != numLong) {
            throw new ArithmeticException("Input overflows int.\n");
        }
        return (int) numLong;
    }
public static int safeLongToInt ( long numLong ) { if ( ( int ) numLong != numLong ) { throw new ArithmeticException ( "Input overflows int.\n" ) ; } return ( int ) numLong ; }
Convert long to int safely.
Convert long to int safely .