How can I cast an Object to an int in java?
If you mean cast a String to int, use Integer.valueOf("123").
Integer.valueOf("123")
You can't cast most other Objects to int though, because they wont have an int value. E.g. an XmlDocument has no int value.