How can I cast an Object to an int in java?
You have to cast it to an Integer (int's wrapper class). You can then use Integer's intValue() method to obtain the inner int.