Josephus saves himself by means of a prophecy

Josephus Flavius, The Wars of the Jews,

translated by William Whiston Book III, Chapter 8:7-9.

7. However, in this extreme distress, he was not destitute of his
usual sagacity; but trusting himself to the providence of God, he
put his life into hazard [in the manner following]: "And now,"
said he, "since it is resolved among you that you will die, come
on, let us commit our mutual deaths to determination by lot. He
whom the lot falls to first, let him be killed by him that hath
the second lot, and thus fortune shall make its progress through
us all; nor shall any of us perish by his own right hand, for it
would be unfair if, when the rest are gone, somebody should
repent and save himself." This proposal appeared to them to be
very just; and when he had prevailed with them to determine this
matter by lots, he drew one of the lots for himself also. He who
had the first lot laid his neck bare to him that had the next, as
supposing that the general would die among them immediately; for
they thought death, if Josephus might but die with them, was
sweeter than life; yet was he with another left to the last,
whether we must say it happened so by chance, or whether by the
providence of God. And as he was very desirous neither to be
condemned by the lot, nor, if he had been left to the last, to
imbrue his right hand in the blood of his countrymen, he
persuaded him to trust his fidelity to him, and to live as well
as himself.

8. Thus Josephus escaped in the war with the Romans, and in this
his own war with his friends, and was led by Nicanor to
Vespasian. But now all the Romans ran together to see him; and as
the multitude pressed one upon another about their general, there
was a tumult of a various kind; while some rejoiced that Josephus
was taken, and some threatened him, and some crowded to see him
very near; but those that were more remote cried out to have this
their enemy put to death, while those that were near called to
mind the actions he had done, and a deep concern appeared at the
change of his fortune. Nor were there any of the Roman
commanders, how much soever they had been enraged at him before,
but relented when they came to the sight of him. Above all the
rest, Titus's own valor, and Josephus's own patience under his
afflictions, made him pity him, as did also the commiseration of
his age, when he recalled to mind that but a little while ago he
was fighting, but lay now in the hands of his enemies, which made
him consider the power of fortune, and how quick is the turn of
affairs in war, and how no state of men is sure; for which reason
he then made a great many more to be of the same pitiful temper
with himself, and induced them to commiserate Josephus. He was
also of great weight in persuading his father to preserve him.
However, Vespasian gave strict orders that he should be kept with
great caution, as though he would in a very little time send him
to Nero.

9. When Josephus heard him give those orders, he said that he had
somewhat in his mind that he would willingly say to himself
alone. When therefore they were all ordered to withdraw,
excepting Titus and two of their friends, he said, "Thou, O
Vespasian, thinkest no more than that thou hast taken Josephus
himself captive; but I come to thee as a messenger of greater
tidings; for had not I been sent by God to thee, I knew what was
the law of the Jews in this case? and how it becomes generals to
die. Dost thou send me to Nero? For why? Are Nero's successors
till they come to thee still alive? Thou, O Vespasian, art Caesar
and emperor, thou, and this thy son. Bind me now still faster,
and keep me for thyself, for thou, O Caesar, are not only lord
over me, but over the land and the sea, and all mankind; and
certainly I deserve to be kept in closer custody than I now am
in, in order to be punished, if I rashly affirm any thing of
God." When he had said this, Vespasian at present did not believe
him, but supposed that Josephus said this as a cunning trick, in
order to his own preservation; but in a little time he was
convinced, and believed what he said to be true, God himself
erecting his expectations, so as to think of obtaining the
empire, and by other signs fore-showing his advancement. He also
found Josephus to have spoken truth on other occasions; for one
of those friends that were present at that secret conference said
to Josephus, "I cannot but wonder how thou couldst not foretell
to the people of Jotapata that they should be taken, nor couldst
foretell this captivity which hath happened to thyself, unless
what thou now sayest be a vain thing, in order to avoid the rage
that is risen against thyself." To which Josephus replied, "I did
foretell to the people of Jotapata that they would be taken on
the forty-seventh day, and that I should be caught alive by the
Romans." Now when Vespasian had inquired of the captives
privately about these predictions, he found them to be true, and
then he began to believe those that concerned himself. Yet did he
not set Josephus at liberty from his hands, but bestowed on him
suits of clothes, and other precious gifts; he treated him also
in a very obliging manner, and continued so to do, Titus still
joining his interest ill the honors that were done him.