How can a law be considered just beyond its mere legalisation?

The Chief Justice of India said that legalisation alone does not make a law just. I want to understand what factors or principles determine whether a law is truly just, even if it has been legally enacted.