### Question:
BitWriter { public int length() { return buffer.size() * Long.SIZE + (Long.SIZE - bitsRemaining) + ((precision >= 0) ? precision : 0); } BitWriter();  BitWriter(int precision); void write(boolean value); void write(boolean data, FieldDefs field); void write(String str); void write(String str, FieldDefs field); void write(IntIterable of, FieldDefs field); void write(Instant i, FieldDefs field); void write(IntIterable of, int length); void write(Instant i); void write(long data, FieldDefs field); void writeV(long i, FieldDefs field); void write(long data, int length); void write(BitWriter bw); int length(); byte[] toByteArray(); String toBase64();  }### Answer:
@Test public void testLength() { BitWriter bw = new BitWriter(0); assertEquals(0, bw.length()); bw.write(true); assertEquals(1, bw.length()); bw.write("hello"); assertEquals(1 + 5 * 6, bw.length()); }