Hammurabi's Legal Code was written around 1780BC.
It is the earliest known set code of justice.
In other places, justice was not a fixed code, but rather a system of justice set down at the moment by whoever decided each case.
Hammurabi's Legal Code