static ImmutableByteSequence prefix(int size, long prefixBits, byte val) {
        checkArgument(val == 0 || val == (byte) 0xff, "Val must be 0 or 0xff");
        byte[] bytes = new byte[size];
        int prefixBytes = (int) (prefixBits / Byte.SIZE);
        Arrays.fill(bytes, 0, prefixBytes, val);
        Arrays.fill(bytes, prefixBytes, bytes.length, (byte) ~val);
        int partialBits = (int) (prefixBits % Byte.SIZE);
        if (partialBits != 0) {
            bytes[prefixBytes] = val == 0 ?
                    (byte) (0xff >> partialBits) : (byte) (0xff << Byte.SIZE - partialBits);
        }
        return new ImmutableByteSequence(ByteBuffer.wrap(bytes));
    }
@Test
    public void testBadPrefixVal() {
        thrown.expect(IllegalArgumentException.class);
        thrown.reportMissingExceptionWithMessage(
                "Expect IllegalArgumentException due to val = 0x7");
        ImmutableByteSequence.prefix(5, 10, (byte) 0x7);
    }