  The Newman-Janis (NJ) algorithm has been extensively used in the literature
to generate rotating black hole solutions from nonrotating seed spacetimes. In
this work, we show, using various constants of motion, that the null geodesic
equations in an arbitrary stationary and axially symmetric rotating spacetime
obtained through the NJ algorithm can be separated completely, provided that
the algorithm is applied successfully without any inconsistency. Using the
separated null geodesic equations, we then obtain an analytic general formula
for obtaining the contour of a shadow cast by a compact object whose
gravitational field is given by the arbitrary rotating spacetime under
consideration. As special cases, we apply our general analytic formula to some
known black holes and reproduce the corresponding results for black hole
shadow. Finally, we consider a new example and study shadow using our analytic
general formula.
