@Override
	public byte[] encodeRepresentation(String repr, MemBuffer buf, Settings settings, int length)
			throws DataTypeEncodeException {
		int format = getFormatSettingsDefinition().getFormat(settings);
		BigInteger value;
		int radix;
		String suffix;
		switch (format) {
			case FormatSettingsDefinition.CHAR:
				StringDataInstance sdi =
					StringDataInstance.getStringDataInstance(this, buf, settings, getLength());
				try {
					return sdi.encodeReplacementFromCharRepresentation(repr);
				}
				catch (MalformedInputException | UnmappableCharacterException
						| StringParseException e) {
					throw new DataTypeEncodeException(repr, this, e);
				}
			case FormatSettingsDefinition.HEX:
				radix = 16;
				suffix = "h";
				break;
			case FormatSettingsDefinition.DECIMAL:
				radix = 10;
				suffix = "";
				break;
			case FormatSettingsDefinition.BINARY:
				radix = 2;
				suffix = "b";
				break;
			case FormatSettingsDefinition.OCTAL:
				radix = 8;
				suffix = "o";
				break;
			default:
				throw new AssertionError();
		}

		if (!repr.endsWith(suffix)) {
			throw new DataTypeEncodeException("value must have " + suffix + " suffix", repr, this);
		}
		try {
			value = new BigInteger(repr.substring(0, repr.length() - suffix.length()), radix);
		}
		catch (Exception e) {
			throw new DataTypeEncodeException(repr, this, e);
		}

		/**
		 * Ghidra doesn't actually heed signedness unless the format is DECIMAL. Thus, for user
		 * input, and to make this an inverse of getRepresentation, we'll adjust values between SMAX
		 * and UMAX to ensure they get encoded as expected, rather than rejected. We'll still accept
		 * signed values, though, since the user would rightly expect those to work, even though
		 * it'll get echoed back in unsigned form.
		 */
		if (format != FormatSettingsDefinition.DECIMAL && isSigned()) {
			BigInteger umax = BigInteger.ONE.shiftLeft(8 * length);
			BigInteger smax = umax.shiftRight(1);
			if (smax.compareTo(value) <= 0 && value.compareTo(umax) < 0) {
				value = value.subtract(umax);
			}
		}
		return encodeValue(value, buf, settings, length);
	}
Get integer representation of the big-endian value.
<p>
Does not handle CHAR format, use
{@link StringDataInstance#getCharRepresentation(DataType, byte[], Settings)}

@param bigInt BigInteger value with the appropriate sign
@param settings integer format settings (PADDING, FORMAT, etc.)
@param bitLength number of value bits to be used from bigInt
@return formatted integer string
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/AbstractIntegerDataType.java