public static byte setBooleanToByte(byte modifiers, int i, boolean bool) {
        boolean old = getBooleanFromByte(modifiers, i);
        if (old && !bool) { // true-->false
            return (byte) (modifiers - (1 << i));
        } else if (!old && bool) { // false-->true
            return (byte) (modifiers + (1 << i));
        }
        return modifiers;
    }
@Test
    public void setBooleanToByte() {
        byte b = 0x35; // 0011 0101
        byte b1 = CodecUtils.setBooleanToByte(b, 0, true);
        Assert.assertEquals(b, b1);
        byte b2 = CodecUtils.setBooleanToByte(b, 1, false);
        Assert.assertEquals(b, b2);

        byte b3 = CodecUtils.setBooleanToByte(b, 3, true);
        Assert.assertFalse(b == b3);
        Assert.assertTrue(CodecUtils.getBooleanFromByte(b3, 3));
        byte b4 = CodecUtils.setBooleanToByte(b, 4, false);
        Assert.assertFalse(b == b4);
        Assert.assertFalse(CodecUtils.getBooleanFromByte(b4, 4));
    }