One of the methods of rice growing brought by the early migrants was wet-field cultivation, which required substantial inter-village co-operation and so gave rise to the first kingdoms in the archipelago.
Merchants from India brought Hinduism to the archipelago, which spread quickly. By the fifth century, a myriad of small Hindu kingdoms peppered the archipelago, the most successful being the Srivijaya kingdom, based in Palembang in South Sumatra. For approximately four hundred years, beginning in around the seventh century AD, Srivijaya controlled the Melaka Straits - and the accompanying lucrative trade in spices, wood, camphor, tortoise shell and precious stones - and extended its empire as far north as Thailand and as far east as West Borneo. Srivijaya was also a seat of learning and religion, with over a thousand Buddhist monks living and studying within the city.
Whilst the Srivijayans enjoyed supremacy around the coasts of Indonesia, small kingdoms began to flourish inland. In particular, the rival Saliendra and Sanjaya (the latter sometimes known as Mataram) kingdoms began to wield considerable influence on the volcanic plains of Central Java, constructing spectacular monuments such as the magnificent temple at Borobodur , built by the Buddhist Saliendras, and the manifold temples of Prambanan , built by the Hindu Sanjayas. But by the twelfth century things had begun to change: the Cholas of southern India destroyed the Srivijayan empire, and the influence of the Saliendras and Sanjayas was declining in the face of new empires emerging in the east of Java.