Java Collections
1. How to create generic array
- List<Integer>[] array = new List[len];
- import java.lang.reflect.Array; ArrayList<Integer>[] array = (ArrayList<Integer>[])Array.newInstance(ArrayList.class, len);
2. Bit operations
- Get the odd number that is larger or equal to itself
- x | 1
- Get the rightmost 1 of x
- x & (-x)
- Remove the last bit from x
- x & (x-1)

浙公网安备 33010602011771号