Multiloop algebras determined by n commuting algebra automorphisms of finite order are natural generalizations of the classical loop algebras that are used to realize affine Kac-Moody Lie algebras. In this paper, we obtain necessary and sufficient conditions for a Zn-graded algebra to be realized as a multiloop algebra based on a finite dimensional simple algebra over an algebraically closed field of characteristic 0. We also obtain necessary and sufficient conditions for two such multiloop algebras to be graded-isomorphic, up to automorphism of the grading group. We prove these facts as consequences of corresponding results for a generalization of the multiloop construction. This more general setting allows us to work naturally and conveniently with arbitrary grading groups and arbitrary base fields.