Java 7 --> Java 6. Cast Object to an int in java6/7