public void checkCollision(Dimension rec) {
		boolean alive = true;
		for(int i = snakeLength; i > 0; i--){
			if((i > 4) && (X[0] == X[i]) && (Y[0] == Y[i]))
				alive = false;
		}
		
		if(Y[0] >= rec.height)
			alive = false;
		
		if(Y[0] < 0)
			alive = false;
		
		if(X[0] >= rec.width)
			alive = false;
		
		if(X[0] < 0)
			alive = false;
		
		if(!alive)
			b.setState(STATE.GAMEOVER);	
	}