Von neumann loves binary

I am having some problem while running the code. According to me the code is right but i dont know why it is giving me runtime error with an exception.
Please help.

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t>0) {
int n = sc.nextInt();
int decimal = 0;
int p=0;
while(n!=0) {
decimal+=((n%10)*Math.pow(2,p));
n=n/10;
}
System.out.println(decimal);
t–;
}
}
}

Error given is:
Exception in thread “main” java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1594) at java.base/java.util.Scanner.nextInt(Scanner.java:2258) at java.base/java.util.Scanner.nextInt(Scanner.java:2212) at Main.main(Main.java:5)