@Override
	public String getMenuDisplay(long value, int size, boolean isSigned, Program program) {
		Scalar scalar = new Scalar(size * 8, value);
		long v;
		String prefix = "0b";
		if (isSigned) {
			v = scalar.getSignedValue();
			if (v < 0) {
				v = -v;
				prefix = "-0b";
			}
		}
		else {
			v = scalar.getUnsignedValue();

		}
		String bitString = Long.toBinaryString(v);
		int bitlen = bitString.length();
		if (bitlen <= 8) {
			bitlen = 8;
		}
		else if (bitlen <= 16) {
			bitlen = 16;
		}
		else if (bitlen <= 32) {
			bitlen = 32;
		}
		else {
			bitlen = 64;
		}
		return prefix + StringUtilities.pad(bitString, '0', bitlen);
	}
Convert a selected constant in the decompiler to a binary representation.
Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ConvertBinaryAction.java