for(a=0;a<=8;a++){ for(b=0;b<=8;b++){ if(numfields[a][b] != (b+1)){ errorvar2=1; qa=Integer.toString(a+1); } } }