Converting from int type to long type is an up-conversion and can be directly implicitly converted, but converting from long type to int type is down-conversion, and data overflow may occur: The
following conversion methods are mainly for reference:
One, forced type conversion
[java]
long ll = 300000;
int ii = (int)ll;
Two, call the intValue() method
[java]
long ll = 300000;
int ii= new Long(ll).intValue();
Three, first convert the long into a string String, and then into an Integer
[java]
long ll = 300000;
int ii = Integer.parseInt(String.valueOf(ll));