public void addBytesNOP(String addr, int length) throws MemoryAccessException {
		if (length == 1) {
			addInstructionBytes(addr(addr), (byte) 0xf7); // nop #1
		}
		else if (length < 18) {
			byte[] bytes = new byte[length];
			bytes[0] = (byte) 0xd9;
			length -= 2;
			bytes[1] = (byte) (length | 0x30);
			for (int i = 0; i < length; i++) {
				bytes[2 + i] = 0;
			}
			addInstructionBytes(addr(addr), bytes); // nop #n
		}
		else {
			throw new IllegalArgumentException("Unsupported NOP length: " + length);
		}
	}
Add NOP instruction bytes of specified byte length
@param addr instruction address
@param length length of NOP instruction in bytes
@throws MemoryAccessException
Ghidra/Features/Base/src/main/java/ghidra/test/ToyProgramBuilder.java