When your game has a map which is too large to fit into memory, then the default solution to the problem is to use chunks.

Divide your map into rectangular chunks which are about as large as the screen. Only load the chunk the player is in and the adjacent chunks into memory. When the player moves to a different chunk, persist the no longer needed chunks to the hard drive and unload them (which you do in Java by making sure that there are no variables anymore which point to them). When the player returns, load the chunks from the hard drive back into memory.