0

So... For example i have some number like 9ecd which one is 40653 BUT i want to use it like signed -24883. So, is there any way to do it without "sing bit"-workaround by ">>15" (sic!) if i even cant use it at declaration at this point

UPD: It was all sunny and such with Oded answer, but then i tried to use the same trick on sbyte.

4

1 回答 1

3

简单的,

int u = 0x9ecd;
int i = (short)u;

i将会-24883

于 2013-05-26T20:39:44.227 回答