magnetic field within the solid cylinder at any arbitrary distance r from centre can be found from ampere law.
now magnetic energy density=1/(2 mew zero) B^2
this is to be integrated within required limits.
the volume element may be chosen as r dr dtheta dz where z is the height and theta is the polar angle- ie. a cylindrical co ordinate system.
hope this helps...