Job's Righteousness and God's Judgment (Job 27)

Job is not done speaking and now he is one who affirms that God carries out His justice.  Job knows that God will judge the world, but Job carries a deep frustration within himself.  On the one hand Job knows the fate of the wicked, he knows that God judges the wicked, but Job’s punishment parallels the wicked’s life.  Job does not see how this can be reconciled.  So, how do we reconcile Job’s life with the Lord judging the wicked?