Notice that David is not asking for God’s love and justice. David is singing out that His love and justice already exists. It is important to praise God not only for the love He shows us, but also for the fact that He does bring justice His way and on His timing.
One may ask why God would want us to sing of His justice. His justice refers to what is right and fair. Unlike the world’s justice, God’s justice is perfectly just even when we face the challenges of life. This is because God is working all things together for good, to them who love Him and are called for His purpose (see Romans 8:28).
Furthermore, we ought to sing out because God does give us His love and justice. The best way to see it is simply to ask for it, and watch it happen in our lives.
 I will behave myself wisely in a perfect way. O when wilt Thou come unto me? I will walk within my house with a perfect heart.  I will set no wicked thing before mine eyes: I hate the work of them that turn aside; it shall not cleave to me.
David is expressing his desire to please God and therefore make the effort to be as sinless as possible. Just because God has forgiven all of our sins, this does not give us a free license to go sin all we want. If we have given our lives over to Jesus, then it should be our desire to please Him with our lives. We should strive to avoid sin as much as possible and make our best effort to lead a sinless life.
It is wonderful to know that we can have God’s strength if we ask Him. Through prayer, we can have the strength to overcome temptation. God does His part and we must do our part. What is our part? Paul wrote this way, But put ye on the Lord Jesus Christ, and make not provision for the flesh, to fulfil the lusts thereof. (Romans 13:14).
David is not saying he is perfect. Rather, he is expressing his dependence upon God to lead a life that is pleasing to Him in the first place. If we desire to live a life pleasing to God and be grateful for what He is doing for our lives, then we should praise Him for protecting us.
At the beginning of verse 3, David says that he will set no vile thing before his eyes. In other words, he is going to try to avoid temptation as much as possible. We also should ask God to guide us and keep us away from anything and everything that causes us to turn from Him in the first place. This verse ends with David expressing that the actions of faithless and unbelieving people will not be his actions. Again the idea is not to be perfect, but to make a serious effort to seek God and do our best to live by the principals found in God’s word. Remember, David is writing this as a leader and has a desire to be led by God.