Here you can find the source of toInt(long l)
Parameter | Description |
---|---|
IllegalArgumentException | if the is greater than the biggest int |
private static int toInt(long l)
//package com.java2s; public class Main { /**//from w w w . j a v a2s . c o m * Converts long value to int under the conditions that the long value is representable * as an int. * @throws IllegalArgumentException if the {@l} is greater than the biggest int */ private static int toInt(long l) { if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE) { throw new IllegalArgumentException(l + " cannot be cast to int without changing its value."); } return (int) l; } }