### Question:
DittedBitSequence { public String getHexString() { String uncompressed = this.toString(); String[] parts = uncompressed.trim().split(" "); StringBuilder sb = new StringBuilder(); for (int i = 0, max = parts.length; i < max; ++i) { if (parts[i].contains(".")) { sb.append(parts[i]); if (i != (max - 1)) { sb.append(" "); } continue; } String hexByte = Integer.toHexString(Integer.parseUnsignedInt(parts[i].trim(), 2)); if (hexByte.length() < 2) { hexByte = "0" + hexByte; } sb.append("0x"); sb.append(hexByte); if (i != (max - 1)) { sb.append(" "); } } return sb.toString(); } DittedBitSequence();  DittedBitSequence(String dittedBitData);  DittedBitSequence(String dittedBitData, boolean hex);  DittedBitSequence(DittedBitSequence op2);  DittedBitSequence(byte[] bytes);  DittedBitSequence(byte[] bytes, byte[] mask);  DittedBitSequence(DittedBitSequence s1, DittedBitSequence s2); byte[] getValueBytes(); byte[] getMaskBytes(); @Override int hashCode(); @Override boolean equals(Object obj); DittedBitSequence concatenate(DittedBitSequence op2); boolean isMatch(int pos, int val); int getIndex(); int getSize(); int getNumFixedBits(); int getNumUncertainBits(); void writeBits(StringBuffer buf); @Override String toString(); String getHexString(); int getNumInitialFixedBits(int marked); static int[] popcount; }### Answer:
@Test public void testDittedBitSequenceConstructor() { byte bits = (byte) 0xe0; byte dits = (byte) 0xe7; DittedBitSequence dSeq = new DittedBitSequence(new byte[] { bits }, new byte[] { dits }); assertEquals("111..000", dSeq.getHexString()); }
@Test public void testDittedBitSequenceConstructor_2() { DittedBitSequence dSeq = new DittedBitSequence("0x048f", true); assertEquals("0x04 0x8f", dSeq.getHexString()); dSeq = new DittedBitSequence("00000000", false); assertEquals("0x00", dSeq.getHexString()); dSeq = new DittedBitSequence("11111111", false); assertEquals("0xff", dSeq.getHexString()); dSeq = new DittedBitSequence("1111000000001111", false); assertEquals("0xf0 0x0f", dSeq.getHexString()); dSeq = new DittedBitSequence("0.0.1.1.11111111", false); assertEquals("0.0.1.1. 0xff", dSeq.getHexString()); }