Really strange bug with collision

Helo,

I’m coding games in java for a while now and for my collision detection,I’ve always use this code to check and it ALWAYS works perfectly.

Recently I changed my computer and after a while of the game running this method stop working. It is driving me crazy becuase I know there’s is nothing actually wrong with the code. I already try to debug it, and if I save my new code to the project while is debuging the collision come back to normal.

Its driving me crazy…
I hope I made myself clear and sorry for my english

Here is the code:

	public static boolean move(int nextx,int nexty)
	{
		
		int w = tiles.length;
		int h = tiles[0].length;
		Rectangle box = new Rectangle(nextx,nexty,32,32);
		int minX = (nextx/32);
		int minY = (nexty/32);
		int maxX = (nextx/32) + 1;
		int maxY = (nexty/32) + 1;
		
		for(int xp = minX; xp <= maxX; xp++)
		{
			for(int yp = minY; yp <= maxY; yp++)
			{
				if(xp < 0 || xp >= w || yp < 0 || yp >= h) continue;

					if(tiles[xp][yp].solid)
					{
						Rectangle box2 = new Rectangle(xp*32,yp*32,32,32);
						if(box.intersects(box2)){
							return false;
						}
					}

				
			}
		}
		
		return true;
	}
		if(right)
		{
			x+=speed;
			if(!World.move(x, y))x-=speed;
		}
		else if(left)
		{
			x-=speed;
			if(!World.move(x, y))x+=speed;
			
		}
		if(up)
		{
			y-=speed;
			if(!World.move(x, y))y+=speed;
			
		}
		else if(down)
		{

			y+=speed;
			if(!World.move(x, y))y-=speed;
			
		}

When I say that if I debug the game and save some content it comes back to normal,it could be anything like

System.out.println(“Hello world”);

Its crazy…