Wow, what a confident statement. Is this something you would ask God to do; "Put me on trial and examine me!" David has a clear conscience—what an important thing to maintain. Here are some specific ways we can have a clear conscience.
First, keep a short account of sins. Seek God's forgiveness as soon as you sin.
"If we confess our sins, He is faithful and righteous to forgive us our sins and to cleanse us from all unrighteousness" (1 John 1:9, NASB).
Second, don't listen to Satan's constant accusations against you.
"For the accuser of our brothers and sisters has been thrown down to earth—the one who accuses them before our God day and night" (Revelation 12:10b).
He is called "the accuser of the brethren" and he is constantly accusing you before God.
We are forgiven though Jesus' blood and righteous life!
There's an incident that occurred in the Old Testament that reveals how our Lord rebukes the charges Satan brings against us. It's found in the book of Zechariah. Here's the passage:
"Then the angel showed me Jeshua the high priest standing before the angel of the Lord. The Accuser, Satan, was there at the angel's right hand, making accusations against Jeshua. And the Lord said to Satan, 'I, the Lord, reject your accusations, Satan. Yes, the Lord, who has chosen Jerusalem, rebukes you. This man is like a burning stick that has been snatched from the fire.' Jeshua's clothing was filthy as he stood there before the angel. So the angel said to the others standing there, 'Take off his filthy clothes.' And turning to Jeshua he said, 'See, I have taken away your sins, and now I am giving you these fine new clothes.' Then I said, 'They should also place a clean turban on his head.' So they put a clean priestly turban on his head and dressed him in new clothes while the angel of the Lord stood by" (Zechariah 3:1-5).
The Lord rejected Satan's accusations against Jeshua and took away Jeshua's filthy clothing and put fine new clothes on him. This is exactly what Jesus does when He saves us and justifies us. He takes away the old filthy clothes of our sin and cleanses us and covers us with His righteousness!
Thank you Lord for taking away our sins!
(Commentary Mark Martin)