How do I convert/cast a Double
object to an int
?
Double d = new Double(12.34);
int i = 12 //is what I'm looking for
If I had a double
I would just use:
double z = 12.34;
int i = (int)z;
Note: I want it to truncate the Double
(so 12.9 becomes 12) because I know that d
actually was an integer that was converted to a Double.
I.e. I want to call (int) on a Double
.