Cylindrical Wire with Current (Griffiths Physics)

A current $I=constant$ goes through a cylindrical wire (having radius $a$). What is the magnetic filed outside and inside the wire if
a) current is uniform on the outside of the wire
b) current is such that $J sim s$ ($s$ is distance from axis)
Show My Homework -Cylinder with current

Take a circular path of radius r from wire center. Apply Ampere circuital law

$∮ B*d L=μ_0*I_{inside}$

If $I=constant$

For $r<a$

$I_{inside}=I*S(r)/S_{tot} =I*r^2/a^2$

so that $2πr*B(r)=μ_0*I*(r^2/a^2)$    or $B(r)=(μ_0 Ir)/(2πa^2 )$

For $r>a$ one has $I_{inside}=I$
$B(r)*2πr=μ_0*I$   so that $B(r)=(μ_0 I)/(2πr)$

If $J=k*s=(k*r)$  one has

$I=∫_0^a (k r*dS)=∫_0^a k r*(2πr*d r)=(2π*k a^3)/3$   so that $k=3I/(2πa^3 )$

For $r<a$

$I_{inside}=∫_0^r k r*(2πr*d r)=k*(2πr^3)/3=I*(r/a)^3$

$2πr*B(r)=μ_0*I*(r/a)^3$    so that $B(r)=(μ_0 I)/2π*r^2/a^3$

For $r >a$  one has $I_{inside}=I$  so that the result is the same as when $I=constant$
$B(r)=(μ_0 I)/2πr$