Judge says rapist will go to prison then gives him bail