RandomAccessMemory implements Memory { private int readWord(int address) { return data[getWordIndex(address)] & 0177777; } 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 testReadWord() { short[] ramData = new short[] { 0, 1, (short) 0177777, (short) 0177776 }; RandomAccessMemory ram = new RandomAccessMemory("TestRam", 01000, ramData); assertEquals(0, ram.read(false, 01000)); assertEquals(0, ram.read(false, 01001)); assertEquals(1, ram.read(false, 01002)); assertEquals(1, ram.read(false, 01003)); assertEquals(0177777, ram.read(false, 01004)); assertEquals(0177777, ram.read(false, 01005)); assertEquals(0177776, ram.read(false, 01006)); assertEquals(0177776, ram.read(false, 01007)); }