This is one of the moments in the life of Julius Caesar that spotlights his character. Captured by pirates, he thought the amount of ransom they were demanding put too low a value on him, so he told the pirates to ask for more. During Caesar's captivity he behaved amiably, joining them in their activities. His behavior was so friendly, the pirates probably didn't believe he would retaliate, but when he was freed, he made sure they were executed.
Dryden Translation of Plutarch's Caesar - Captured by Pirates
After a short stay there [in Bithynia] with Nicomedes, the king, in his passage back he was taken near the island of Pharmacusa by some of the pirates, who, at that time, with large fleets of ships and innumerable smaller vessels, infested the seas everywhere.
When these men at first demanded of him twenty talents for his ransom, he laughed at them for not understanding the value of their prisoner, and voluntarily engaged to give them fifty. He presently despatched those about him to several places to raise the money, till at last he was left among a set of the most bloodthirsty people in the world, the Cilicians, only with one friend and two attendants. Yet he made so little of them, that when he had a mind to sleep, he would send to them, and order them to make no noise. For thirty-eight days, with all the freedom in the world, he amused himself with joining in their exercises and games, as if they had not been his keepers, but his guards. He wrote verses and speeches, and made them his auditors, and those who did not admire them, he called to their faces illiterate and barbarous, and would often, in raillery, threaten to hang them. They were greatly taken with this, and attributed his free talking to a kind of simplicity and boyish playfulness. As soon as his ransom was come from Miletus, he paid it, and was discharged, and proceeded at once to man some ships at the port of Miletus, and went in pursuit of the pirates, whom he surprised with their ships still stationed at the island, and took most of them. Their money he made his prize, and the men he secured in prison at Pergamus, and he made application to Junius, who was then governor of Asia, to whose office it belonged, as praetor, to determine their punishment. Junius, having his eye upon the money, for the sum was considerable, said he would think at his leisure what to do with the prisoners, upon which Caesar took his leave of him, and went off to Pergamus, where he ordered the pirates to be brought forth and crucified; the punishment he had often threatened them with whilst he was in their hands, and they little dreamt he was in earnest.