Job 21:16

Lo, their good is not in their hand: the counsel of the wicked is far from me.

The saying belongs to Job's answer to Zophar in chapters 20-21, which lies inside the extended debate between Job and his three friends about his afflictions running through chapters 20-37. That debate closes at chapter 31, when Elihu steps in to correct Job along the same line as the others without Job making him any answer. The wicked prosper here in this present life, while their punishment comes in the future. Their good is not in their own hand, for their prosperity is not ultimately in their own control.

In the same utterance Job puts the counsel of the wicked far from himself and rejects it. Not every statement in the book is true merely because the book is inspired, and the friends' claims are often generally true but wrongly applied to Job. Suffering does not prove that a person is under God's displeasure, so adversity is no reason for discouragement.