Write an article that answers the following question: When did the last event happen?
In the latter half of the 16th century, the Sultanate of Demak, the dominant power in the island of Java, disintegrated into several independent states. At the turn of the 17th century, three of these states emerged as the leading powers: the Sultanate of Banten in western Java, the Sultanate of Mataram in inland central Java, and the Duchy of Surabaya in coastal eastern Java. Mataram consolidated its power by absorbing other principalities: Pajang in c.1588, Demak , Madiun and Kediri . Following Mataram's unsuccessful westward expedition against Banten in about 1597, Mataram turned its expansion eastward, into areas under the influence of Surabaya. The Duchy of Surabaya was centered roughly in today's city of Surabaya in the northern coast of eastern Java. It was a wealthy and powerful state, and the city was an important port in the trade route between Malacca and the Spice Islands., The city was approximately 37 kilometres in circumference, and was fortified by canals and cannons. Allied with the nearby state of Pasuruan, the Duchy expanded its influence throughout the eastern part of Java in the beginning of the 17th century. By 1622, it was in control of Gresik and Sedayu in eastern Java. It was also the overlord of Sukadana and Banjarmasin in southern Borneo. More doubtful reports said it might have also extended its influence to Pasuruan, Blambangan, the Brantas valley region, and Wirasaba. Other than these, Surabaya was also allied with Tuban, Malang, Kediri, Lasem, all in eastern Java, as well as Madura off the northern coast. This alliance was primarily a response to the growing power of Mataram, and Surabaya was the founder and the most powerful member.