class Bitlist {

  @SuppressWarnings("NarrowingCompoundAssignment")
  public Bytes serialize() {
    int len = size;
    byte[] array = new byte[sszSerializationLength(len)];
    IntStream.range(0, len).forEach(i -> array[i / 8] |= ((data.get(i) ? 1 : 0) << (i % 8)));
    array[len / 8] |= 1 << (len % 8);
    return Bytes.wrap(array);
  }

  public  Bitlist(int arraySize, long maxSize);
  public  Bitlist(Bitlist bitlist);
  private  Bitlist(int size, BitSet data, long maxSize);

}