Taken from Qur’anic verses from 17 to 25 of Surah Saad (38)]
And remember our slave Dawud (David), endued with power.
Verily, he was ever oft-returning in all matters and in repentance (toward Allah). Verily, we made the mountains to glorify Our Praises with him [Dawud (David)] in the ‘Ashi (i.e. after the mid-day till sunset) and IshrÃ¢q (i.e. after the sunrise till mid-day). And (so did) the birds assembled: all with him [Dawud (David)] did turn (to Allah i.e. glorified His Praises). We made his kingdom strong and gave him Al-Hikmah (wisdom, etc.) and sound judgment in speech and decision.
And has the news of the litigants reached you? When they climbed up the wall into (his) MihrÃ¢b (a praying place or a private room). When they entered in upon Dawud (David), he was terrified of them, they said: “Fear not! (We are) two litigants, one of whom has wronged the other, therefore judge between us with truth, and treat us not with injustice, and guide us to the Right Way.
Verily, my brother (in religion) has ninety nine ewes, while I have (only) one ewe and he says: “Hand it over to me, and he overpowered me in speech.”
[Dawud (David)] said (immediately without listening to the opponent): “He has wronged you in demanding your ewe in addition to his ewes. And, verily, many partners oppress one another, except those who believe and do righteous good deeds, and they are few.”
And Dawud (David) guessed that we have tried him and he sought Forgiveness of his Lord, and he fell down prostrate and turned (to Allah) in repentance. So we forgave him that, and verily, for him is a near access to us, and a good place of (final) return (Paradise).