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 b = new BigInteger(sc.next());
There is also:
BigInteger b = sc.nextBigInteger();