Following recent work by Marathe and Parrondo [PRL, 104, 245704 (2010)], we construct a classical Hamiltonian system whose energy is reduced during the adiabatic cycling of external parameters, when initial conditions are sampled microcanonically. Combining our system with a device that measures its energy, we propose a cyclic procedure during which energy is extracted from a heat bath and converted to work, in apparent violation of the second law of thermodynamics. This paradox is resolved by deriving an explicit relationship between the average work delivered during one cycle of operation, and the average information gained when measuring the system's energy.