Check out example codes for "long to int java 8". It will help you in understanding the concepts better.

Code Example 1

import static java.lang.Math.toIntExact;

long foo = 10L;
int bar = toIntExact(foo);

Learn ReactJs, React Native from akashmittal.com