question: public static String readStringNZ ( Memory mem , int address , int n ) { address &= Memory . addressMask ; if ( address + n > MemoryMap . END_RAM ) { n = MemoryMap . END_RAM - address + 1 ; if ( n < 0 ) { n = 0 ; } } byte [ ] bytes = new byte [ Math . min ( n , 10000 ) ] ; int length = 0 ; IMemoryReader memoryReader = MemoryReader . getMemoryReader ( address , n , 1 ) ; for ( ; n > 0 ; n -- ) { int b = memoryReader . readNext ( ) ; if ( b == 0 ) { break ; } if ( length >= bytes . length ) { byte [ ] newBytes = new byte [ bytes . length + 10000 ] ; System . arraycopy ( bytes , 0 , newBytes , 0 , bytes . length ) ; bytes = newBytes ; } bytes [ length ] = ( byte ) b ; length ++ ; } return new String ( bytes , 0 , length , Constants . charset ) ; }
target:  Read a string from memory. The string ends when the maximal length is reached or a '\0' byte is found. The memory bytes are interpreted as UTF-8 bytes to form the string.