Quantum Nondemolition Measurement of the Motional Energy of a Trapped Atom