public static String toBinary(String hex) {

		// To do this properly, convert each byte to an int, then turn that int into a string.  We
		// can't do it all as one operation because the hex string could represent a number too
		// large for an integer.

		// Chunk up the string into bytes, removing all spaces first.
		hex = hex.replaceAll("\\s", "");
		String[] byteStrs = hex.split("(?<=\\G.{2})");

		// This is the final string we'll be returning.
		String retString = "";

		// Loop over the byte strings, converting each one to a binary string.
		for (String byteStr : byteStrs) {
			int bint = Integer.parseInt(byteStr, 16);
			String bin = Integer.toBinaryString(bint);
			bin = padZeros(bin);
			retString += bin;
		}

		return retString;
	}
Returns a binary representation of the given hex string.  This will pad the string
with '0's at the beginning to make a full byte.

Note that spaces are allowed in the input, but will be ignored.

@param hex
@return
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/instructionsearch/util/InstructionSearchUtils.java