The Bodhisatta was once an ascetic who lived in the Himalayas. The king was seeking self-improvement and he asked people to tell him his faults so he could correct them, but nobody in the city would say anything negative. So the king wandered the countryside is disguise, yet still found nobody with anything bad to say. So he went into the Himalayas and there he wandered the forest and he came upon the Bodhisatta. The Bodhisatta welcomed the stranger and offered him some figs. They were delicious and the king asked why they were so sweet. The Bodhisatta explained that when a king rules without justice, fruits, honey, molasses, and the like lose their good flavor until the king is once again righteous.
The king, without identifying himself, returned to the palace and stopped being fair in order to put the Bodhisatta’s words to the test. A short time later he went back to see the Bodhisatta and tried another fig, which was so bitter he spat it out. This time the king identified himself and explained what he had done, promising to set everything right again.
In the Lifetime of the Buddha
One time a king came to hear the Buddha preach. He told the king to rule righteously and that sensual pleasures lead to misery: when people die their virtuous actions are their only refuge. Then the Buddha told this story as an example of a king in the past being saved by following his advice.
The king from the past was an earlier birth of Ananda, one of the Buddha’s top disciples.