The Tokugawa social hierarchy was based on Chinese Confucian notions of classes. Confucianism had been studied and adapted by the Japanese as far back as the seventh century.
Basically Confucianism is concerned about the development of ethical behavior. Starting with individuals and then the individuals using this developed ethical behavior in the public arena serving as ministers of the state. So in the central thinking of Confucianism, it is not enough to develop your own ethical qualities. You then are duty bound to try to use these in the service of the state, and the state in Confucian terms is, ought to be a state that is run by ethical men.
The Tokugawa shogunate in the seventeenth century and the samurai elite sought to redefine and reconceive this new system, this new order in the realm, using the latest thought available to them, which in this case was a neo-Confucian thought borrowed from China.
This is the second period in which the Japanese borrow a Chinese thought system, in this case, neo-Confucianism, and conceived their political, social, and economic world in those terms.
Although earlier Japanese elites, first the courtiers and then the feudal military figures, often studied Confucian texts, Confucianism never became a full state ideology until the Tokugawa period. Under the Tokugawa, Confucian schools were established in the daimyo domains and the Confucian emphasis on order, loyalty, hard work, and education extended below the warrior class into other parts of Japanese society.
The most important aspect of the borrowed neo-Confucianism in the seventeenth century in Tokugawa Japan is the securing of the social order its social values and political values, its values for governing and values for social order so that the abiding, if you like, impact of neo-Confucianism in Japan was that it becomes part of the social woodwork, from peasants to samurai.