How can I convert a long to int in Java?
Updated, in Java 8: Original Answer: Simple type casting should do it: Note, however, that large numbers (usually larger than 2147483647 and smaller than -2147483648) will lose some of the bits and would be represented incorrectly. For instance, 2147483648 would be represented as -2147483648.