The 29-year-old was being interviewed in the cells of the Hamilton District Court at the end of October last year when he did the indecent act.
Williams had been arrested for a spree of offending around Raglan over several days prior.
In court this week, he admitted a raft of charges in relation to the offending including two charges of unlawfully being in a building one of dangerous driving in October.
He also admitted the indecent act charge and six counts of shoplifting relating to the theft of tobacco, food and drinks from various stores that same month.
When one of the store owners confronted him about his stealing, William’s threatened to “smash” him and was further charged with threatening by way of intimidation.
Other charges stemmed from an incident on October 25 where Williams was seen using a shower on a private property.
He asked the victim to give him some food but the victim felt uneasy and drove away.
Williams ended up following the victim in his car, tailgating him as they drove up Wainui Rd with Williams swerving on to the wrong side of the road into the path of oncoming traffic.
He also admitted the theft of a Nissan Tiida, which had the keys left inside, worth $8000.
In court, Williams’ counsel, Amin Osama, who was not the lawyer subjected to his indecent act, handed up a remorse letter written by his client.
When asked how old Williams was by Judge Saunders, Osama said he was “very young, considering the history that he has and the state of his life”.
Both his personal history and drug use were contributing factors to the numerous charges on which he was being sentenced and said his pre-sentence report painted a “very bleak picture of Mr Williams”.
As for his compulsory driving disqualification for the dangerous driving charge, Osama asked that it be backdated to the time of the offence as he had been in custody the whole time.
Judge Saunders was shocked by the length of his criminal history given Williams’ age.
“You are 29 years old, Mr Williams, and you have already amassed 12 pages of previous convictions, significant dishonesty since your first conviction in 2011 and that has resulted in many sentences of imprisonment.
“But you have not committed any offending of a sexual nature, so I don’t know what was going on or what you were thinking when you committed that offence.
“For someone so young to have committed so many offences with the inevitable daily methamphetamine use leads me to wonder if there is something underneath that still hasn’t been addressed by any of the sentences you have received in the past.”
Judge Saunders said prison was the only option.
After applying discounts for his guilty plea and totality - due to the large number of charges - he was jailed for 10 months and two weeks, and disqualified from driving for six months, backdated to October.