The density allows you to convert a known volume to mass or known mass to volume therefore if you multiple the volume by the density you will get the mass or if you divide the mass by the density you will get the volume. Before applying the equations, you need to make sure the units of the volume, mass and/or density are the same. If they are not then you will need to make sure to convert them to the respective units.
Volume x density = mass
Mass/density = volume
9 cm3 x 2.7 g/cm3 = 24.3 grams