scanner check if int

Java
boolean isAnInt = scanner.hasNextInt();
Source

Also in Java: