How can I cast an Object to an int in java?
You can't. An int is not an Object.
int
Object
Integer is an Object though, but I doubt that's what you mean.
Integer