Judge Jonathan Karesh handed down the maximum sentence on Wednesday to a Foster City teen caught masturbating over a sleeping girl last year.
Justin Scott Shing, 19, will serve two years in state prison, will pay $350 in fines and will register as a lifetime sex offender.
According to the San Mateo County District Attorney's Office, in May, 2012, Shing crept into the bedroom of a 17-year-old girl past midnight in, pulled back her sheets and masturbated over her, leaving semen on her sheets.
Three months later, a man found Shing in his 9-year-old daughter's bedroom at 3 a.m., staring at the girl's bed on his hands and knees. The man grabbed Shing and called the police, DA's Office notes reveal.
Shing's trial and sentencing were previously delayed so he could finish his semester at UC Riverside. He had been out of jail on $100,000 bail but will start his prison sentence immediately.