How to cast an Object to an int?
How can I cast an Object to int in java?
Assuming the object is an Integer object, then to cast an object to int you can do this:
int i = ((Integer) obj).intValue();
If the object isn't an Integer object, then you have to detect the type and convert it based on its type.