java.lang.ClassCastException: class java.lang.Long cannot be cast to class java.lang.Integer code example Example: java.lang.long cannot be cast to java.lang.integer Long.valueOf(x).intValue()