Here you can find the source of long2int(final long l)
public static int long2int(final long l)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . j a v a2s .co m*/ * Returns the int value that is closest to l. That is, if l can fit into a 32-bit unsigned * number, returns (int)l. Otherwise, returns either Integer.MAX_VALUE or Integer.MIN_VALUE as * appropriate. */ public static int long2int(final long l) { int m; if (l < (m = Integer.MAX_VALUE) && l > (m = Integer.MIN_VALUE)) return (int) l; return m; } }