In the universe one heavenly body revolves around another massive heavenly body (The Earth revolves around the Sun and the moon revolves around the Earth). The centripetal force required by the lighter body to revolve around the heavier body is provided by the gravitational force of attraction between the two. For an orbit of given radius, the mass of the heavier body determines the speed with which the lighter body must revolve around it. Thus, if the period of revolution of the lighter body is known, the mass of the heavier body can be determined.
For example, in the case of Sun – planet system, the mass of the Sian M can be calculated if the distance of the Sun from the Earth r, the period of revolution of the Earth around the Sun T and the gravitational constant G are known using the relation: M = (4π2/G) * (r2/T2)