How can I convert a long to int in Java?
You can use the Long wrapper instead of long primitive and call
Long
long
Long.intValue()
Java7 intValue() docs
It rounds/truncate the long value accordingly to fit in an int.
int