移位运算
/*** 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;
?
為什么用移位運算?
1. 得到的一定是偶數
2. 簡潔 (上面例子中如果直接賦int值是 1073741824 ,沒有意義的一組數字,不好記,太可怕)
3. 控制位數 (int 是32位)
轉載于:https://www.cnblogs.com/zno2/p/5610913.html
總結
- 上一篇: ACM/ICPC 之 DP解有规律的最短
- 下一篇: 知识梳理——CSS篇