The properties of a collapsing spherical bubble have been studied in the past using the methods of continuum gas dynamics. In this report the problem is approached in an entirely new way by using the molecular dynamics of hard spheres to represent a dense gas during the final stages of cavity collapse. The advantage of this method is that it is only necessary to assume that the laws of classical mechanics are valid in order to ensure that all the transport properties and equation of state for the gas are properly taken into account. The disadvantage is that the trajectories of only a relatively small number of particles can be followed on even today's fastest computers, so that the calculations are limited to small systems. The methods used are essentially the same as those already employed to study hard spheres in a channel or a spherical cavity. Four cases are examined, with wall Mach numbers of 0.5, 1.0, 1.5 and 15.0. The temperature, pressure and density distributions are calculated inside the cavity for several average densities during the course of bubble collapse. Our simulation also indicates that a heavier gas will gain more energy from the wall than a light gas, possibly explaining the observation that heavy, dissolved gases yield more luminosity than light gases during cavity collapse.