primitive long to int java code example
Example 1: long to int java 8
import static java.lang.Math.toIntExact;
long foo = 10L;
int bar = toIntExact(foo);
Example 2: java long to integer
// auto-unboxing does not go from Long to int directly, so
Integer i = (int) (long) theLong;