Cognizant interview question

Sort array based on stream java8