Whenever a person is convicted of the offense of aggravated sexual assault, sexual assault, aggravated criminal sexual contact, kidnapping pursuant to paragraph (2) of subsection c. of N.J.S. 2C:13-1, endangering the welfare of a child by engaging in sexual conduct which would impair or debauch the morals of the child pursuant to subsection a. of N.J.S. 2C:24-4, endangering the welfare of a child pursuant to paragraph (4) or (5) of subsection b. of N.J.S. 2C:24-4, leader of a child pornography network pursuant to section 8 of P.L. 2017, c. 141(C.2C:24-4.1), or an attempt to commit any such crime, the judge shall order the Department of Corrections to complete a psychological examination of the offender, except the judge shall not require a psychological examination if the offender is to be sentenced to a term of life imprisonment without eligibility for parole. The examination shall include a determination of whether the offender's conduct was characterized by a pattern of repetitive, compulsive behavior and, if it was, a further determination of the offender's amenability to sex offender treatment and willingness to participate in such treatment. The court's order shall contain a determination of the offender's legal settlement in accordance with subdivision D of article 3 of chapter 4 of Title 30 of the Revised Statutes.
N.J.S. § 2C:47-1