Representation of solutions of Hamilton-Jacobi equations