When we call Javert a bloodhound, we mean it. This guy is easy to understand, because he has one motivation, one goal, and one purpose in life: to trust in the law and enforce it to its fullest extent. We'd like to call him a robot, but a robot wouldn't show passion for its job in the way that Javert does. As the narrator tells us: "He was one of those people who, even glimpsed, make an immediate impression; there was an intensity about him that was almost a threat. His name was Javert and he belonged to the police" (22.214.171.124).
In other words, you can tell within five seconds of meeting this guy that he's as stiff as a board and totally unrelenting in his sense of duty. But it's not enough to say that Javert is a devoted cop. He's also devoted to the idea of order:
[Javert's] mental attitude was compounded of two very simple principles, admirable in themselves but which, by carrying them to extremes, he made almost evil – respect for authority and hatred of revolt against it. (126.96.36.199)
This single sentence is the most important one you'll read in this book, at least when it comes to understanding Javert. For him, the status quo in French society is a fact of life, and he'll die before he allows anyone to mess with it. The problem with this kind of single-mindedness? If he ever starts to question this purpose, he'll spin out into a Does Not Computer spiral.
Throughout Les Misérables, Javert is uncompromising in his enforcement of the law. But he doesn't just do it out of duty. It also brings him massive pleasure. When he's tracking down and arresting criminals, he's like a pig in… well, let's let Hugo tell us:
Javert was in heaven. Without being fully conscious of the fact, but still with a sense of his importance and achievement, he was at that moment the personification of justice, light, and truth in their sublime task of stamping out evil. (188.8.131.52)
No wonder that his world turns upside down when Jean Valjean saves him from being killed by a gang of French rebels. After Valjean has let Javert go, Javert turns around and does the same to Valjean. This single act breaks Javert's moral code and destroys Javert's sense of right and wrong.
As the book tells us, "his greatest anguish was the loss of certainty. He had been torn up by the roots. The code he lived by was in fragments in his hand" (184.108.40.206). In the end, he's so overwhelmed by Valjean's act of compassion that he jumps off a bridge and kills himself. It turns out that he has lived in a world of "black and white" morality for too long to suddenly switch to a world filled with shades of grey.