The Medang or Mataram Kingdom was a Javanese Hindu–Buddhist kingdom that flourished between the 8th and 10th centuries. It was based in Central Java, and later in East Java. Established by King Sanjaya, the kingdom was ruled by the Sailendra dynasty.During most of its history, the kingdom seems to rely heavily on agricultural pursuit, especially extensive rice farming, and later also benefited from the maritime trade.