The Jataka, Vol. II, tr. by W.H.D. Rouse, , at sacred-texts.com
"Virtue is lovely," etc.--This story the Master told at Jetavana, about a brahmin who put his reputation to the test. The circumstances which gave rise to it, and the story itself, are both given in the Silavīmaṁsa Birth-tale, in the First Book. Here, as before
When Brahmadatta was king of Benares, his chaplain resolved to test his own reputation for virtue, and on two days abstracted a coin from the
[paragraph continues] Treasurer's counter. On the third day they dragged him to the king, and accused him of theft. On the way he noticed some snake-charmers making a snake dance. The king asked him what he had done such a thing for. The brahmin replied, "To try my reputation for virtue ": and went on
 "Here I proclaim how virtue is all-blest
And lovely in the world: whereof possest
He that is virtuous evermore is said
Perfection's path to tread.
"To kinsfolk dear, he shines among his friends;
And when his union with the body ends,
He that to practise virtue has been fain
In heaven is born again."
Having thus in three stanzas declared the beauty of virtue and discoursed to them, the Bodhisatta went on--"Great king, a great deal has been given to you by my family, my father's property, my mother's, and what I have gained myself: there is no end to it. But I took these coins from the treasury to try my own value. Now I see how worthless in this world is birth and lineage, blood and family, and how much the best is virtue. I will embrace the religious life; allow me to do so!" After many entreaties, the king at last consented. He left the world, and retired to Himalaya, where he took to the religious life, and cultivated the Faculties and the Attainments until he came to Brahma's world.
When the Master had ended this discourse, he identified the Birth: "At that time the Brahman chaplain who tried his reputation for virtue was I myself."
292:2 Compare Nos. 86, 290, 305, 330, 362.