And what is justice anyway? Is it punishing people for being bad? If so, why? Do we want to see people suffer for what they have done to us? In other words, is it revenge?
Actually, there is no justice in revenge. We all have a primitive instinct for wanting to inflict pain if someone has hurt us. This is called the fight-or-flight response, which is legitimate if we're actually being attacked. But we humans have long term memories, and we also have analytical abilities. Put those pieces together the wrong way, and it forms a brooding, vengeful mentality capable of retaliation, long after the threat has passed. And yet nobody ever actually got any satisfaction out of retaliating for being hurt. This is why people who have engaged in such behaviors have to explain it to other people, over and over — they're still wondering why they got no joy out of it, and they're still trying to convince themselves that they did the right thing, even when they know deep down inside that they didn't. There is no joy in retaliation, any more than there is joy in the fight-or-flight response. The only difference is that self defense is sometimes necessary, while retaliation isn't — ever.
Do we punish people as a deterrent against future wrong-doing?
This, indeed, is a motivation for hurting others, but it isn't the only way to fix a problem. Still, it does highlight the fact that justice isn't about righting the wrongs that have been done in the past — it's a pursuit of the peace of mind that comes from knowing that the problem has been fixed, and that we will not be victimized in the future. Incarceration of the criminals is one way of preventing them from hurting us, and so that's the generic "punishment" — we can sleep soundly if we know that the criminals are behind bars, and can't get to us.
Of course, incarceration isn't much of a deterrent to some people — especially the poor — who have few freedoms anyway, due to financial constraints. And most of the crimes in this world occur out of simple economic necessity. When it gets to the point that freedom from want in a prison would be more freedom than being financially constrained to go without food, jail is no deterrent at all. Still, law-abiding citizens deserve the sense of security that can only come from knowing that they are protected from the bad people.
The best peace of mind comes from knowing that the underlying problem has been fixed, such that the crime will not be committed again, because there is no longer a reason. And since most crimes are economically motivated, it is our obligation to nurture the welfare of everybody in society, including — if not especially — the poor people.