### Question:
TezUtils { public static byte[] toByteArray(BitSet bits) { if (bits == null) { return null; } byte[] bytes = new byte[bits.length() / 8 + 1]; for (int i = 0; i < bits.length(); i++) { if (bits.get(i)) { bytes[(bytes.length) - (i / 8) - 1] |= 1 << (i % 8); } } return bytes; }  static void addUserSpecifiedTezConfiguration(Configuration conf); static ByteString createByteStringFromConf(Configuration conf); static byte[] createUserPayloadFromConf(Configuration conf); static Configuration createConfFromByteString(ByteString byteString); static Configuration createConfFromUserPayload(byte[] bb); static byte[] compressBytes(byte[] inBytes); static byte[] uncompressBytes(byte[] inBytes); @Private static String cleanVertexName(String vertexName); static void updateLoggers(String addend); static BitSet fromByteArray(byte[] bytes); static byte[] toByteArray(BitSet bits); static String getContainerLogDir(); @Private
  static final int MAX_VERTEX_NAME_LENGTH; }### Answer:
@Test public void testBitSetToByteArray() { BitSet bitSet = createBitSet(0); byte[] bytes = TezUtils.toByteArray(bitSet); Assert.assertTrue(bytes.length == ((bitSet.length() / 8) + 1)); bitSet = createBitSet(1000); bytes = TezUtils.toByteArray(bitSet); Assert.assertTrue(bytes.length == ((bitSet.length() / 8) + 1)); }