Pergunta de entrevista da empresa Microsoft

An array has one or two digits number only. I have to sort them such them, the number formed using that array is maximum. Eg - [14, 8 , 7] -> [8, 7, 14] as 8,714 is the largest number which can be formed.