RandomAccessMemory implements Memory { private void writeWord(int address, int wordData) { data[getWordIndex(address)] = (short) wordData; } RandomAccessMemory(String id, int startAddress, int size, Type type);  RandomAccessMemory(String id, int startAddress, int size);  RandomAccessMemory(String id, int startAddress, short[] data);  RandomAccessMemory(String id, int startAddress, byte[] data); @Override String getId(); @Override int getStartAddress(); @Override int getSize(); @Override short[] getData(); void putData(short[] dataToPut); @Override int read(boolean isByteMode, int address); @Override boolean write(boolean isByteMode, int address, int value); @Override boolean isRelatedAddress(int address); @Override void saveState(Bundle outState); @Override void restoreState(Bundle inState); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString();  }
@Test public void testWriteWord() { short[] ramData = new short[] { 0, 0 }; RandomAccessMemory ram = new RandomAccessMemory("TestRam", 01000, ramData); ram.write(false, 01000, 0377); assertEquals(0377, ram.read(false, 01000)); ram.write(false, 01001, 0377); assertEquals(0377, ram.read(false, 01000)); ram.write(false, 01002, 0177777); assertEquals(0177777, ram.read(false, 01002)); ram.write(false, 01003, 0177777); assertEquals(0177777, ram.read(false, 01002)); ram.write(false, 01002, 01777777); assertEquals(0177777, ram.read(false, 01002)); }