Maximum entropy principle for rarefied polyatomic gases