Examine me, O Lord, and prove me; try my reigns and my heart.
David, known as a man after God's own heart, wanted a character that reflected his Lord. That wouldn't have happened if he prayed, "Create in me a clean heart," (Ps. 51:10) then ignored the Lord's cleansing process.
David doesn't have to question Who the final authority is. As a shepherd boy, a fugitive, and finally as King, he knew that there was one he must answer to concerning his deeds.
2) He sought the Lord as Judge.
Throughout the Psalms, David seeks God as a shelter, deliverer, buckler, and so much more. Yet, he continues to seek Him as Judge, an approach that many fear and strive to ignore. (Psalm 54:1; 35:24; 7:8; 43:1)
You see, God is not only Judge, He is an All-Forgiving judge... under one condition. John 1:9 tells us of that condition, "If we confess our sins"... The key is confession. Many people have a misconception about God. They see Him as a ruthless judge from whom they cower in fear. Nothing could be further from the truth. He is not only an administer of righteous law but of grace - wonderful and amazing grace. He established rules for our protection, yet also provides forgiveness for our wrongdoing, "if we confess."
Many point accusing fingers at David for his well-known sin with Bathsheba. He lusted, he murdered, he committed adultery! But when he is confronted and condemned for his sin, he confessed. God granted him grace. Even though he may not have prayed, "Judge me, O Lord" at this time, he still received it. Otherwise, he would have lived the rest of his life in misery.
Do we allow fear to keep us from approaching God in the same manner as David? Are we afraid of what will be revealed to us?
But why would we want those sins to remain in our hearts? Why would we not seek cleansing from the Lord?
Could you imagine an individual appearing before the King of England wearing rags, covered in mud, and smelling as if they hadn't showered in 3 months?! He would be showing great disrespect by his appearance. When summoned, one expects quality and cleanliness to be presented to such an authority. Why then should we treat God the Father differently?
If you wish to live in the presence of the King of Kings, Psalm 34:18 tells us how we may do so. He is nigh... He is close... He is near... to those with a broken heart, a contrite spirit (feeling sorrow or regret), and to all that call on Him.
No other king is capable or compassionate enough to do so!