1 Samuel 22:2
And every one that was in distress, and every one that was in debt, and every one that was discontented, gathered themselves unto him; and he became a captain over them: and there were with him about four hundred men. And every one that was in distress, and every one that was in debt, and every one that was discontented, gathered themselves unto him; and he became a captain over them: and there were with him about four hundred men.
Driven into the wilderness as a fugitive from Saul's jealousy and cut off from human support, David was joined there by men who sought him out. Every one that was in distress and every one that was in debt and every one that was discontented gathered themselves unto him, and he became a captain and leader over them. Among them were those who had lost confidence in Saul's rule and who sought refuge with David. They grew to a company of about four hundred men, forming a small, ordered community with him in the mountains.
Their difficult character, joined with the uncertainty and unrest of wilderness life, its unceasing peril and need for frequent flight, made stern self-discipline essential for David. Leading such followers aroused and developed in him power to deal with men, sympathy for the oppressed, and hatred of injustice.
Through years of waiting and peril he learned to find in God his comfort and support and life. He learned that only by God's power could he come to the throne and only in God's wisdom could he rule wisely. Thus this school of hardship and sorrow prepared him to execute judgment and justice to all his people.