Potential energy in a gravitational field

I've seen the following formula for the potential energy of a body in a gravitational field ($\rho$ is the density, $g$ is the gravitational acceleration):

$$\rho g \int_E z dV$$

Can you please explain to me how this formula is deduced? Thank you.

-

This is simply the sum of the gravitational potential energy over all the points that make up the body. Each point has a mass $\rho dV$, meaning the mass density times the infinitesimal volume element, and this is multiplied by g and h, because the potential energy of a point at height h is $mgh$.
If you are asking why the potential energy is $mgh$ for a point, this can be argued using reversible elevators attached by pullies. If you want to raise a mass m by a certain amount h, you can do this by putting an equal mass on the other side of a pulley-elevator and lowering the mass by an equal amount. This process is easy--- you don't have to do work--- because the masses balance on the two sides.