Read integer implementation using java.util.Scanner