How does java calculate this?
int number = (int) Long.parseLong("F9DFF755", 16);
Long.parseLong("F9DFF755", 16); == 4192204629 (too big to be stored by an int)
Casted to int : -102762667
How does java force a long to fit into an int?
How does java calculate this?
int number = (int) Long.parseLong("F9DFF755", 16);
Long.parseLong("F9DFF755", 16); == 4192204629 (too big to be stored by an int)
Casted to int : -102762667
How does java force a long to fit into an int?
Casting a long to an int simply consist in keeping the last 32 bits of the long, and ignoring the first 32 bits.