给一个int赋最大值

根据二进制补码的性质,先使1<<31再减一即可。

int x = (1<<31)-1;

  

猜你喜欢

转载自www.cnblogs.com/Wangsheng5/p/11651244.html