Judge spends night in jail with man he sentenced