let's try to think in a different direction. someone that commits a crime is not happy, because happy healthy people don't commit crimes. the first thing that should be done after arrest is they should be sent on a vacation of their choice in a beautiful picturesque location somewhere but under supervision. so like a beautiful holding cell. after a month of relaxation they should be brought back and go through the court process, but jail should never be sentenced. house arrest at worst, if the home is healthy. if the home is unhealthy, then they should be put under house arrest in a beautiful new home with everything they need to recover and feel good. this would show them the world cares and it can be good for them and to them, meanwhile while they're under house arrest they would be allowed to work and also trained in weight lifting, eating a nutritious diet, and maybe a sport or other skill of their choice, so they have something to build on after the sentence instead of falling to drugs or alcohol again because they feel terrible. this is the proper, correct approach.  of course, better than rehabilitation or punishment would be prevention. and the only way to prevent is to work to develop societies that are healthy, environments that are healthy and happy for everyone.  no human is a criminal (except in extreme cases) punishment never works, it only destroys. punishment is a destructive force, just on that it has to be rejected
Croatia