Jesus made this specific prophecy with the intent that when Peter heard the rooster he would be prompted to remember the prediction of the Lord. It is certainly a miracle that Jesus could make a prediction of such detail and tell exactly when it would happen (cf. Luke 22:61,62). One who was not omniscient would not have guessed that Peter would have denied Jesus so soon in light of the fact that Peter was then claiming allegiance to the point of death!
As a matter of curiosity, it would be interesting to be able to see into Peter's mind at the moment after the rooster crowed the first time (cf. Mark 14:68). Did he hear it? Did he realize that he had already failed his Lord and that he would soon do so again? Did he resolve himself to not deny Jesus again? What were the thoughts of Simon at that time?
"But he spoke more vehemently, 'If I have to die with You, I will not deny You!'" (Mark 14:31). A good lesson for all to learn is that speaking loudly and fervently does not add one whit to the truthfulness of our words. Truth can be whispered or screamed; likewise with that which is false.
"And they all said likewise" - All of the eleven agreed with Peter's sentiments, but John was the only one who really kept this promise and remained with Jesus until the very end. The other apostles may not have verbally denied Jesus as Peter did, but this was only because they were too cowardly to even follow Jesus from a distance! Interestingly enough, tradition has it that John was the only apostle who died a natural death. All of the others are believed to have died as martyrs.
Luke 22:35-38 records:
"And He said to them, 'When I sent you without money bag, knapsack, and sandals, did you lack anything?' So they said, 'Nothing.' Then He said to them - 'But now, he who has a money bag, let him take it, and likewise a knapsack; and he who has no sword, let him sell his garment and buy one. For I say to you that this which is written must still be accomplished in Me: "And He was numbered with the transgressors." For the things concerning Me have an end.' So they said, 'Lord, look, here are two swords.' And He said to them, "It is enough."
When Jesus had previously sent His apostles out on the "limited commission" (cf. Matt. 10:9ff), their needs were provided for and they were generally received well. Jesus referred back to that pleasant time to draw a sharp contrast: now things would be different! Drastic changes were coming for disciples of Jesus, and the changes were not for the better. Their future would not be a smooth one but rather it would be filled with suffering, persecution, and bitter opposition. Jesus exhorts them to be prepared for such. He was not just speaking of the perils of that night.
"For I say to you that this which is written must still be accomplished in Me: 'And He was numbered with the transgressors'" (Isa. 53:12). Jesus was about to be betrayed and crucified (between two thieves), and the road was about to get rough for the apostles too. The apostles declared to Jesus that there were two swords in their possession. He replied by saying, "It is enough." Based on Luke 22:49ff, one can see that the swords were evidently for defensive purposes and not for attacking or causing harm. Although God wants us to be peacemakers, we are authorized to protect our families and ourselves (cf. I Tim. 5:8).