This question has been answered in many ways in different ages. God is the Perfect Being, and justice is part of perfection. Therefore, God is just. So whatever of injustice we see in the world, will be rectified eventually. In other words, He has no needs, and injustice is either from ignorance and fanaticism, or from need, and none of these are conceivable for the Perfect Being.
Evil is necessary for the greater good.
Refraining from thousand goods for the sake of one evil, is itself a great evil. Man's freedom is the cause of evil. Here freedom is not in political sense. It means being able to do good or bad. It is only mankind who has this ability.