0

Below code snippet gives error for 1.0E27%10 this arithmetic operation

"ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183):  [util.c:840]

And the code is

int []A = {1000000000, 1000000000, 1000000000};
int cnt=0;
double product = 1;
for(int i= A.length-1 ;  cnt < 3; i--,cnt++ ) {
     product*=A[i];
}
System.out.println(product%10); //// 1.0E27%10
while(product%10 == 0) {
    product = product/10;
    zeroCnt++;
}
azro
  • 53,056
  • 7
  • 34
  • 70
Nilam
  • 11
  • 3

1 Answers1

1

This is an old JVM bug, rather than an error with doubles. Try updating Java or adding

System.exit(0); 

at the end of your code.

GDC
  • 91
  • 1
  • 4