// Reads and prints the lrgest and smallest values in a files. End-of-file is used to 
// determine when to stop reading numbers.

import java.io.*;
import java.util.*;

public class MinMax {
	public static void main(String [] args) throws Exception {
		Scanner scanner = new Scanner(new File("numbers.text"));

		if (!scanner.hasNextInt()) {
			System.out.println("File is empty - min/max is meaningless");
			System.exit(1);
		}

		int num = scanner.nextInt();
		int min = num, max = num;

		while (scanner.hasNextInt()) {
			num = scanner.nextInt();
			if (num < min) min = num;
			if (num > max) max = num;
		}

		System.out.println("The minimum of the numbers read in is: " + min);
		System.out.println("The maximum of the numbers read in is: " + max);
	}
}
