Make the camera follow multiple characters

Currently, I use the following code to make the screen follow the main character:

				//focus is the entity the camera should focus on.
				float focusX = focus.currX + focus.width  / 2,
					   focusY = focus.currY + focus.height / 2;
				
				//visibleWidth and visibleHeight is the size of the container/window.
				//width and height is the size of the entire map
				translateX = Math.min(stage.width  - stage.visibleWidth,   Math.max(0, focusX - stage.visibleWidth  / 2)); 
				translateY = Math.min(stage.height - stage.visibleHeight,  Math.max(0, focusY - stage.visibleHeight / 2));
				//scaleX and scaleY are untouched

This code works fine as long as there is one entity to focus on.

I want a code that supports 2-4 objects. I have seen games that have it. Basically, when the entities are to far from each other, the scaleX and scaleY are decreased to zoom out.
But I am not sure how to code this.

Some help?