private String determineFillerValue() throws Exception {

		FunctionIterator funcIter = listing.getFunctions(true);
		HashMap<String, Integer> fillValuesHash = new HashMap<String, Integer>();

		while (funcIter.hasNext() && !monitor.isCancelled()) {

			// Get undefined byte immediately following function
			Address maxAddress = funcIter.next().getBody().getMaxAddress();
			Data undefinedData = listing.getUndefinedDataAt(maxAddress.next());
			if (undefinedData == null) {
				// No undefined filler bytes found, keep going to next function
				continue;
			}

			// Add filler to hash
			String key = ProgramUtilities.getByteCodeString(undefinedData);
			if (fillValuesHash.containsKey(key)) {
				// Hash already contains key, just increment count
				int val = fillValuesHash.get(key);
				fillValuesHash.put(key, val + 1);
			}
			else {
				// Add to hash
				fillValuesHash.put(key, 1);
			}
		}

		println("Possible filler values (and their counts): " + fillValuesHash.toString());

		// Decide that filler value is the one with the greatest count				
		String filler = getValueWithHighestCount(fillValuesHash);

		return filler;
	}
This function tries to determine the fill value used by the current program.
The byte value occurring most is the winner.

@return filler
@throws Exception
Ghidra/Features/Base/ghidra_scripts/CondenseFillerBytes.java