NZEC error on java

Could somebody please help me out with this code. I have checked it on ideone and it doesn’t return any error.

Take care of constraints. It is given that A is an integer with atmost 1000 digits. That is a way larger number to fit into a 64bit datatype(long).

OK thanks. I will use the BigInteger class