Dude, how the fuck do you smoke in class. That seems unreal to me.
Its easy really, the bigger the class and the classroom the better. You sit in the back by an open window, be sure both top and bottom are open to allow better air circulation. Wait for teacher to become occupied with other students. Pack only a hit in your bowl, take it, hold as long as possible, exhale out the window. With the window open from top and bottom (my school has some sort of pull-out windows) the smoke should be sucked out of the room. This also depends on air pressure and temperature in the class and outside. If there is any lingering smell find a girl to spray some shit.
I would advise you do this nearer the end of class so as the get the fuck out of there as soon as possible and have gum/mint ready.

lol smoking in a HOLDING CELL mmm sure
They're are plenty of drugs in prison, who do you think the cops sell them to after they confiscate them?