I was not 100% law abiding in my youth, nor were many of my friends - but we did have some morals and boundaries.
In some cases it was simply because we knew certain things like unjustified violence and predatory behaviour were simply wrong - but with others the hassle of arrest, Court etc and the risk of losing liberty ( as well as longer term consequences like reduced employment prospects and raised motor and house insurance premiums) did have at least have /some/ deterrent.
Most young lads, even if they push boundaries of what society considers acceptable, don't really want to be full on criminals - even those who lead hedonistic lifestyles with drugs, but it does mean they have to have something better to look forward to in later life..