The well-known algorithm for quantum phase estimation requires that the considered unitary is available as a conditional transformation depending on the quantum state of an ancilla register. We present an algorithm converting an unknown n-qubit pair-interaction Hamiltonian into a conditional one such that standard phase estimation can be applied to measure the energy. Our essential assumption is that the considered system can be brought into interaction with a quantum computer. For large n the algorithm could still be applicable for estimating the density of energy states and might therefore be useful for finding energy gaps in solid states.