The static method belows reads an int value from the console using Scanner class.

Java Code:
	public static int readIntValue() throws InputMismatchException
	{
		Scanner in = new Scanner(System.in);  
		int integer;
		System.out.println("Enter an integer value: ");
		integer = in.nextInt();
		return integer;
	}