As you can read here, the moment of inertia of an object with density $ \rho$:

$\displaystyle I = \int_V \rho r^2 \d V$ (21)

This integral can be worked out for a hollow cylinder rotating around its symmetry axis:

$\displaystyle I = \rho \int r^2 \d V = \rho \int_{r_i}^{r_o} r^2 r\d r \int_0^{2\pi}\d\theta\int_0^l \d z$ (22)

after integration:

$\displaystyle I = 2\pi l \rho \left[ \frac{r^4}{4}\right]_{r_i}^{r_o} = \frac{\pi l \rho (r_o^4-r_i^4)}{2}$ (23)

If we would want to compare 2 cylinders having the same mass, but with another inner and outer radius, we would have to write $ \rho$ as a function of the mass $ M$:

$\displaystyle M$ $\displaystyle = \rho \int_{r_i}^{r_o} r\d r \int_0^{2\pi}\d\theta\int_0^l dz$ (24)
  $\displaystyle = \rho l \pi (r_o^2-r_i^2) \quad \Rightarrow \quad \rho= \frac{M}{l \pi (r_o^2-r_i^2)}$ (25)

The moment of inertia can also be written as a function of mass instead of density:

$\displaystyle I$ $\displaystyle = \frac{M}{2} \frac{(r_o^4-r_i^4)}{(r_o^2-r_i^2)}=\frac{M}{2} \frac{(r_o^2-r_i^2)(r_o^2+r_i^2)}{(r_o^2-r_i^2)}$ (26)
  $\displaystyle = \frac{M}{2} (r_o^2+r_i^2)$ (27)