### Question:
BitFieldDataType extends AbstractDataType { @Override public String getRepresentation(MemBuffer buf, Settings settings, int length) { if (bitSize == 0) { return ""; } BigInteger big = getBigIntegerValue(buf, settings); if (big == null) { return "??"; } DataType dt = baseDataType; if (dt instanceof TypeDef) { dt = ((TypeDef) dt).getBaseDataType(); } if (dt instanceof Enum) { return ((Enum) dt).getRepresentation(big, settings, effectiveBitSize); } AbstractIntegerDataType intDT = (AbstractIntegerDataType) dt; if (intDT.getFormatSettingsDefinition().getFormat( settings) == FormatSettingsDefinition.CHAR) { if (big.signum() < 0) { big = big.add(BigInteger.valueOf(2).pow(effectiveBitSize)); } int bytesLen = BitFieldDataType.getMinimumStorageSize(effectiveBitSize); byte[] bytes = DataConverter.getInstance(buf.isBigEndian()).getBytes(big, bytesLen); return StringDataInstance.getCharRepresentation(this, bytes, settings); } return intDT.getRepresentation(big, settings, effectiveBitSize); } protected  BitFieldDataType(DataType baseDataType, int bitSize, int bitOffset); protected  BitFieldDataType(DataType baseDataType, int bitSize); boolean isZeroLengthField(); static int getEffectiveBitSize(int declaredBitSize, int baseTypeByteSize); static int getMinimumStorageSize(int bitSize); static int getMinimumStorageSize(int bitSize, int bitOffset); static void checkBaseDataType(DataType baseDataType); static boolean isValidBaseDataType(DataType baseDataType); @Override void addParent(DataType dt); int getBaseTypeSize(); int getStorageSize(); int getBitSize(); int getDeclaredBitSize(); int getBitOffset(); DataType getBaseDataType(); AbstractIntegerDataType getPrimitiveBaseDataType(); @Override final SettingsDefinition[] getSettingsDefinitions(); @Override final boolean isEquivalent(DataType dt); @Override final int hashCode(); @Override final boolean equals(Object obj); @Override Settings getDefaultSettings(); @Override final DataType copy(DataTypeManager dtm); @Override BitFieldDataType clone(DataTypeManager dtm); @Override int getLength(); @Override String getDescription(); @Override Object getValue(MemBuffer buf, Settings settings, int length); @Override Class<?> getValueClass(Settings settings); @Override String getRepresentation(MemBuffer buf, Settings settings, int length); @Override void setDefaultSettings(Settings settings); @Override int getAlignment(); @Override String toString();  }### Answer:
@Test public void testHexRepresentationSignedBaseType() throws Exception { assertEquals("1h", getRepresentation(bitField(1, 0), 0x55)); assertEquals("0h", getRepresentation(bitField(1, 1), 0x55)); assertEquals("1h", getRepresentation(bitField(2, 0), 0x55)); assertEquals("5h", getRepresentation(bitField(3, 0), 0x55)); assertEquals("5h", getRepresentation(bitField(4, 0), 0x55)); }