If value is > Integer.MAX_VALUE or < Integer.MIN_VALUE * then an exception will be thrown, else the value is cast * down to an int. * * @param value The long value to convert. * @return The converted value. * * @throws DataConversionException Could not safely convert the value. */ public static int toInt(final long value) throws DataConversionException { if (value > Integer.MAX_VALUE || value < Integer.MIN_VALUE) throw new DataConversionException ("can not safly convert to int: " + value); return (int)value; } }