The Jataka, Vol. II, tr. by W.H.D. Rouse, , at sacred-texts.com
"There is a man," etc.--This story the Master told at Jetavana, about the king of Kosala. A very useful subordinate intrigued in the harem. Even though he knew the culprit, the king pocketed the affront, because the fellow was useful, and told the Master of it. The Master said, "Other kings in days long gone by have done the same;" and at his request, told the following story.
Once upon a time, when Brahmadatta was king of Benares, a man of his court fell into an intrigue in the king's harem, and an attendant of this courtier did the same thing in the courtier's house. The man could not endure to be thus affronted. So he led the other before the king, saying, "My lord,  I have a servant who does all manner of work, and he has made me a cuckold: what must I do with him?" and with the question he uttered this first verse following
On hearing this, the king uttered the second verse:--
The courtier saw that these words of the king were aimed at him; and for the future durst do no wrong in the king's house. And the servant likewise, having come to know that the matter had been told to the king, durst for the future do that thing no more.
This discourse ended, the Master identified the Birth:--"I was the king of Benares." And the courtier on this occasion found out that the king had told of him to the Master, and never did such a thing again.