In his childhood, he received instruction from his father, Liu Sanjie (劉三杰). At the age of 12, he studied scriptures with Yuan Ruqi (袁汝契) at the Garden of Military Studies Mosque in Nanjing, (which no longer exists). At the age of 15, he began a career of study in his home. For fifteen years, he read up on Confucianism, Buddhism, Daoism, as well as "Western Studies"; there as nothing he did not read. He considered Confucius and Mencius to be "Sages of the East" and Muhammad to be a "Sage of the West," and that "the teachings of the Sages of East and West, today as in ancient times, are one." He further believed that the scriptures of Islam are also "generally similar to the intentions of Confucius and Mencius." From around the age of 30, he took up residence at the foot of Qingliangshan in Nanjing, where he began to interpret and expound on the Islamic scriptures, using Confucian studies, for a period of about twenty years. During this time, he twice brought his manuscript with him to visit and solicit advice and the opinions of both Muslims and non-Muslims, leaving his tracks throughout Jiangsu, Shandong, Hebei, Henan, Anhui, Zhejiang, Guangdong, and other places. In his later years, he resided at his studio, Saoyelou ("House of Sweeping Leaves"), at Qingliangshan in Nanjing.
He learned Arabic and Buddhism and Daoism. He also wrote several works on Islam in 1674, 1710, and 1721.
His writings became part of the Han Kitab, a collection of literature which synthesized Islam and Confucianism.
He said that Muslims were allowed to believe in the Mandate of Heaven and serve the Emperor, because Allah allowed the Mandate of Heaven to exist.