Tile rendering FPS lag

I use tiles entity in my game they are set in ArrayList. The more tiles I have on my map the lower fps I have. I think I found the problem when I don’t render the fps its 10x bigger.


for (int i = 0; i < tile.size(); i++) {
			tile.get(i).render(screen);
		}

this is how I render the tiles and I think this is the problem because the more tiles I have the slower it renders.
I want to render the tiles only that I will see on the screen.
Something like this


for (int i = 0; i < TheNumberOfTilesICanSeeOnTheScreen(); i++) {
			tile.get(i).render(screen);
		}

Help me please I cant continue making my game because of this serious problem.