More and more Indonesian areas gradually adopted Islam . By the end of the 16th century it was the dominant religion in Java and Sumatra . Other Indonesian areas gradually adopted Islam , making it the dominant religion in Java and Sumatra by the end of the 16th century .