public static boolean isSameByteValue(Address min, Address max, Program program) {
		//throws an IllegalArgumentException if min,max don't defined a proper AddressRange
		AddressSet range = new AddressSet(min, max);
		AddressSetView loadedAndInit = program.getMemory().getLoadedAndInitializedAddressSet();
		if (!range.intersects(loadedAndInit)) {
			return true; //range has no values
		}
		if (!loadedAndInit.contains(range)) {
			return false; //range contains some address with values and some without
			//this might be impossible
		}
		try {
			Byte firstByte = program.getMemory().getByte(min);
			for (Address addr = min.add(1); addr.compareTo(max) <= 0; addr = addr.add(1)) {
				Byte val = program.getMemory().getByte(addr);

				if (!Objects.equals(val, firstByte)) {
					return false;
				}
			}
		}
		catch (MemoryAccessException e) {
			return false; //shouldn't happen
		}
		return true;
	}
Returns true precisely when all of the addresses between min and max (inclusive)
have the same byte value OR all addresses are without values

@param min minimum address
@param max maximum address
@param program program
@return true if all addresses have same value
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/AddressRangeInfo.java