import java.io.File;
import java.io.FileNotFoundException;
import java.util.InputMismatchException;
import java.util.Scanner;

public class LargeAndSmallIntegerRunner {

	public static void main(String args[]) {
		try {

			File inputFile = new File("numbers2.txt");
			Scanner input = new Scanner(inputFile);

			// cannot also be initialized to 0 in this case
			// since file has negative numbers
			int max = Integer.MIN_VALUE;
			int min = Integer.MAX_VALUE;

			while (input.hasNext()) {
				int num = input.nextInt();
				if (num > max)
					max = num;
				if (num < min)
					min = num;
			}
			System.out.println("The maximum number is: " + max);
			System.out.println("The minimum number is: " + min);
			input.close();

		} catch (FileNotFoundException e) {
			System.out.println("Error: File not found.");

		} catch (InputMismatchException e) {
			System.out.println("Error: Incomptabile data in file.");
		}

	}
}
