移位运算
/*** The maximum capacity, used if a higher value is implicitly specified* by either of the constructors with arguments.* MUST be a power of two <= 1<<30.*/static final int MAXIMUM_CAPACITY = 1 << 30;
?
為什么用移位運(yùn)算?
1. 得到的一定是偶數(shù)
2. 簡潔 (上面例子中如果直接賦int值是 1073741824 ,沒有意義的一組數(shù)字,不好記,太可怕)
3. 控制位數(shù) (int 是32位)
轉(zhuǎn)載于:https://www.cnblogs.com/zno2/p/5610913.html
總結(jié)
- 上一篇: ACM/ICPC 之 DP解有规律的最短
- 下一篇: 你应该知道的 RPC 原理