/** * Sets a flag to the supplied value * * @see Flag */ public void setFlag(int bit) { checkFlag(bit); // bits are indexed from left to right flags |= (1 << (15 - bit)); }
/** * Retrieves a flag * * @see Flag */ public boolean getFlag(int bit) { checkFlag(bit); // bits are indexed from left to right return (flags & (1 << (15 - bit))) != 0; }