We propose to calculate the gluon condensate in lattice QCD in an indirect way by extracting it from the correlator of hadronic currents of heavy quarks. Moments (derivatives with respect to momentrm at vanishing momentum) of the vector and pseudoscalar correlators are evaluated. The contribution of the continuum spectrum in addition to the low-lying resonance is observed in accordance with qualitative expectations. Finite size effects are observed and shown to be insignificant for heavy quarks and moderate lattices. A practical definition of the nonperturbatively renormalized heavy quark mass is given.