Two procedures for finding a Hamiltonian for a system of n second-order ODEs, without determining any of its first integrals, are provided. The first procedure is based on the existence of a regular Lagrangian, while the second is based on the existence of a closed invariant two-form of maximal rank. Examples are given to illustrate these procedures.