And Nathan said to David, The Lord also has put away your sin; you shall not die. However, because by this deed you have given great occasion to the enemies of the Lord to blaspheme, the child also who is born to you shall surely die. Then Nathan departed to his house.
And the Lord struck the child that Uriahs wife bore to David, and it became ill. David therefore pleaded with God for the child, and David fasted and went in and lay all night on the ground. So the elders of his house arose and went to him, to raise him up from the ground. But he would not, nor did he eat food with them. Then on the seventh day it came to pass that the child died. And the servants of David were afraid to tell him that the child was dead. For they said, Indeed, while the child was alive, we spoke to him, and he would not heed our voice. How can we tell him that the child is dead? He may do some harm!
When David saw that his servants were whispering, David perceived that the child was dead. Therefore David said to his servants, Is the child dead?
And they said, He is dead.
2 Samuel 12:13-19
David pleads with God to spare the life of his son. Yet after seven days of humbling himself before God, he finds out that God did not do as he wanted Him to do. So what does he do? David does something that is totally contrary to our human nature:
So David arose from the ground, washed and anointed himself, and changed his clothes; and he went into the house of the Lord and worshiped.
2 Samuel 12:20
Despite his many flaws, David still was a man after God's heart.
I don't find it contrary, I think it is what most of us would do - for what else is there to do?
There are no new sins in this world, they have all been done before and will be done again.