A gram is a different measurement from a centimeter. Grams measure the mass of an object. However, centimeters measure length, area (when squared) or volume (when cubed). To convert between the two measurements, you must find a link. Density serves that purpose, since it is a measurement of mass divided by volume  for example, the density is 1.00 gram per cubic centimeter for water or 19.32 grams per cubic centimeter for gold.
Things You'll Need
 Balance scale

Get the mass of the object using a balance scale.

Look up the density of the object in grams per cubic centimeter. Density tables are available in science books and in numerous online resources.

Divide the mass by the density of the object. For example, if you have a nugget of gold weighing 154.56 grams, then its equivalent volume would be 8 cubic centimeters (154.56 grams / 19.32 grams per cubic centimeter).

Take the cuberoot of the volume to calculate the length of one side of a perfect cube. To conclude the example, if you melted the gold, you could form a perfect cube measuring 2 centimeters on each side.
References
 Photo Credit balance image by thierry planche from Fotolia.com