In your case the judge could require you to take a drug test in order to remain out on your own recognizance. If you fail or refuse the test, the judge could put you in jail until you post some ridiculous bond he sets.