when I tried to get an input of type Integer, what I only needed to do was the code below.
Scanner sc = new Scanner(System.in); int N = sc.nextInt();
Scanner sc = new Scanner(System.in); BigInteger bi = sc.nextBigInteger();
Reference: Scanner#nextBigInteger