src/org/nutz/lang/Maths.java
public static int extract(int bs, int low, int high) {
        bs = bs >> low;
        int mask = 0;
        for (int i = 0; i < (high - low); i++) {
            mask += 1 << i;
        }
        return bs & mask;
    }
public static int extract(int bs, int low, int high) {
        bs = bs >> low;
        int mask = 0;
        for (int i = 0; i < (high - low); i++) {
            mask += 1 << i;
        }
        return bs & mask;
    }
Get part of one integer as a new integer

@param bs
original integer
@param low
the low bit position (inclusive), 0 base
@param high
the high bit position (exclusive), 0 base
@return new integer