Java Game - Issue with player "sticking" in collided objects

I have been working on my first actual game with Java/LWJGL. I have had little trouble until working with collisions. I am not using the “normal” rectangle intersection methods but my own, tailored to (hopefully) be more flexible. If you would like me to post how all that works I would be glad to. The collisions work very well however my problem comes when trying to stop the player from entering the entity. My velocities are often more than 1.0f and can leave the player within the entity before I have a chance to set the velocity to zero. Once the player is inside the entity I can no longer move my player. Any ideas? Much thanks.

Here is some of the code:



      public void update(){
		super.update();
		
		//Obtain collided entity if not null//
		Entity entity = null;
		if(CollisionHandler.getCollidedEntity(this) != null){
			entity = CollisionHandler.getCollidedEntity(this);
		}
		
		//Apply gravity to velY//
		if(y > 0) velY += gravity * (Properties.scale / 32f);
		
		//Keep y above 0//
		if(y < 0){
			y = 0;
			velY = 0;
		}
		
		//Slow X in positive direction//
		if(velX != 0 && velX > 0){			
			velX -= 0.5f * (Properties.scale / 32f);
		}
		
		//Slow X in negative direction//
		if(velX != 0 && velX < 0){			
			velX += 0.5f * (Properties.scale / 32f);
		}
		
		if(entity != null){
			
			if(getY() + getHeight() > entity.getY()){
				velY = 0;
			}
			
			if(getY() < entity.getY() + entity.getHeight()) {
				velY = 0;
			}
			
			if(getX() < entity.getX() + entity.getWidth()) {
				velX = 0;
			}
			
			if(getX() + getWidth() > entity.getX()) {
				velX = 0;
			}
		   
		}
		
		//Set X & Y according to velocity//
		x += velX / (Properties.scale * 2f);
		y += velY / (Properties.scale * 2f);			
		
	}
	
	public void jump(float speed){
		velY += speed * (Properties.scale / 32f);
	}
	
	public void moveUp(float speed){
		velY += speed * (Properties.scale / 32f);
	}
	
	public void moveDown(float speed){
		velY = -speed * (Properties.scale / 32f);
	}
	
	public void moveLeft(float speed){
		velX = -speed * (Properties.scale / 32f);	
	}
	
	public void moveRight(float speed){
		velX = speed * (Properties.scale / 32f);
	}