I was wondering about the hypothetical - and apparently improbable - heat death of the Universe when I stumbled upon this seeming contradiction. A certain volume of space with a uniform distribution of particles has maximum entropy. However, the action of gravity would condense these particles, decreasing the entropy of the system, which would violate the second law of thermodynamics.
My question is simply: what am I missing here? What is the solution to this contradiction?