### Question:
NewArrayOp extends MethodStateOp { @Override public void execute(ExecutionNode node, MethodState mState) { HeapItem lengthItem = mState.readRegister(lengthRegister); Object instance = buildInstance(lengthItem); if (instance instanceof Throwable) { node.setException((Throwable) instance); node.clearChildren(); return; } else { node.clearExceptions(); } mState.assignRegister(destRegister, instance, arrayType); } NewArrayOp(MethodLocation location, MethodLocation child, int destRegister, int lengthRegister, String arrayType,
               ClassLoader classLoader); @Override void execute(ExecutionNode node, MethodState mState); @Override String toString(); int getDestRegister(); int getLengthRegister(); String getArrayType();  }### Answer:
@Test public void canCreate2DLocalInstanceArray() throws ClassNotFoundException { int length = 5; initial.setRegisters(0, length, "I"); ExecutionGraph graph = VMTester.execute(CLASS_NAME, "create2DLocalInstanceArray()V", initial); HeapItem consensus = graph.getTerminatingRegisterConsensus(0); assertEquals("[[" + CLASS_NAME, consensus.getType()); assertEquals(length, Array.getLength(consensus.getValue())); Class<?> actualClass = consensus.getValue().getClass(); assertEquals("[[" + CLASS_NAME, actualClass.getName()); }
@Test public void canCreateLocalInstanceArray() { int length = 1; initial.setRegisters(0, length, "I"); ExecutionGraph graph = VMTester.execute(CLASS_NAME, "createLocalInstanceArray()V", initial); HeapItem consensus = graph.getTerminatingRegisterConsensus(0); assertEquals("[" + CLASS_NAME, consensus.getType()); assertEquals(length, Array.getLength(consensus.getValue())); Class<?> actualClass = consensus.getValue().getClass(); assertEquals("[" + CLASS_NAME, actualClass.getName()); }