Here you can find the source of nextInt(final Scanner sc)
public static int nextInt(final Scanner sc)
//package com.java2s; //License from project: Open Source License import java.util.InputMismatchException; import java.util.Scanner; public class Main { public static int nextInt(final Scanner sc) { try {// www . jav a 2 s. c o m return sc.nextInt(); } catch (final InputMismatchException ime) { return 0; } } }