Although Javert seems to be heartless, I can't fault him for one thing. His strict adherence to the law. He faithfully fights for and upholds it. He almost worships it. Law has become his god.
That's why he revered the stars...they were predictable. Unchangeable.
He believes once a person breaks the law, he is a convict for life. No second chances. No chance for change. Once a sinner, always a sinner. No matter where your humble beginnings might find you, once you've blown it, you're done for...
What a sorry world this would be if there were no chance for repentance, forgiveness or reconciliation. No way to wipe the slate clean. No new beginnings!
Thankfully, God does not see life this way. The Bible says in I Corinthians 6: 9-11:
"Or know ye not that the unrighteous shall not inherit the kingdom of God? Be not deceived:neither fornicators, nor idolaters, nor adulterers, nor effeminate, nor abusers of themselves with men, nor thieves, nor covetous, nor drunkards, nor revilers, nor extortioners, shall inherit the kingdom of God. And such WERE some of you:"
We can ALL find ourselves in this list, BUT, this is the GOOD NEWS...
"...but ye were washed, but ye were sanctified, but ye were justified in the name of the Lord Jesus Christ, and in the Spirit of our God."
Made clean...completely NEW!
Javert could not admit that Valjean had changed into a responsible, honest, hardworking and loving man. Quite different from the Valjean he knew in prison.