In 2 Samuel 12 the story is told about God sending the prophet Nathan to David to tell him a story about two men.
2 Sam 12:1 So the LORD sent Nathan the prophet to tell David this story, "There were two men in a certain town. One was rich, and one was poor."
2 "The rich man owned many sheep and cattle."
3 "The poor man owned nothing but a little lamb he had worked hard to buy. He raised that little lamb, and it grew up with his children. It ate from the man's own plate and drank from his cup. He cuddled it in his arms like a baby daughter."
4 "One day a guest arrived at the home of the rich man. But instead of killing a lamb from his own flocks for food, he took the poor man's lamb and killed it and served it to his guest."
5 David was furious. "As surely as the Lord lives," he vowed, "any man who would do such a thing deserves to die!"
This story is not really about a rich man taking a poor man's lamb. It is really about David taking another man's wife and then having the man killed in war so it looked like an accident of war.
Why the pretence? I think the Lord was letting David dictate his own punishment.
In Matthew 7:2 For with what judgment ye judge, ye shall be judged: and with what measure ye mete, it shall be measured to you again.
This is what happened to David. He received what he gave out.
David demanded the death penalty and much more. This man not only had to pay with his life, but was made to make four-fold restitution. This is what happened to David, David's baby son died and the sword would never stop pursuing David.
More than that, God permitted evil to rise out of David's own house to afflict him. David's wives were taken from him the same as he had taken Uriah's wife. Although David committed his sin privately, God would execute His judgment publicly.
We can all praise God that we have a superior and better covenant.
Heb 8:6 But now He has obtained a more excellent ministry, in-as-much as He is also Mediator of a better covenant, which was established on better promises.
God will not judge us the way He judged David under the Old Covenant, because Jesus bore all that judgment for us.
However, there is still the principle of reaping our own judgment. People will treat us the way we treat them. If we are harsh and unforgiving, then people will treat us that way.
Those who show mercy receive mercy!
James 2:13 For judgment is without mercy to the one who has shown no mercy. Mercy triumphs over judgment.
We don't have to learn everything the hard way, we can learn by other people's mistakes. David should be an example to us all. We need to remember that the way we judge others is the way we will be judged.
If we want to be treated mercifully; now would be a good time to start sowing mercy. Remember you will get back what you give out. You will reap according to your sowing. It works just like a boomerang.