How to find largest and smallest numbers from input in Java

Following simple Java program shows how to read input values and then print smallest and largest values. It reads the input from standard input using Scanner and then uses methods from Math class to determine the largest and smallest numbers entered by the user.