There is a thorough character anaylsis here at Enotes.
Here is an excerpt on both Thenardier and Javert that speaks to
their morality (or lack thereof). I have "bolded" the parts
that speak to the morality issue.
Monsieur Thernardier is "(t)he unscrupulous innkeeper and
his wife take care of Cosette, but treat her poorly. He embarks on
a life of crime, getting involved with the worst criminals in
Paris, and attempts to entrap and rob Valjean. Although he ends up
in prison, he escapes. He helps Valjean escape from the sewers when
Valjean is trapped there with Marius. Thenardier plays a
central part in the plot. He does good in spite of his evil
intentions, not knowing what the consequences of his own actions
Javert serves as Valjean's nemesis throughout the novel,
continually threatening to expose his past and bring him under the
control of the law. In his exaggerated, nearly fanatical
devotion to duty and his lack of compassion, Javert represents a
punitive, vengeful form of justice.
You can find out much more about these two characters by
visiting the link below.