RandomAccessMemory implements Memory { private int readByte(int address) { int wordData = readWord(address); return (address & 1) == 0 ? wordData & 0377 : wordData >> 8; } 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 testReadByte() { byte[] ramData = new byte[] { 0, 1, (byte) 0377, (byte) 0376 }; RandomAccessMemory ram = new RandomAccessMemory("TestRam", 01000, ramData); assertEquals(0, ram.read(true, 01000)); assertEquals(1, ram.read(true, 01001)); assertEquals(0377, ram.read(true, 01002)); assertEquals(0376, ram.read(true, 01003)); }