public class Jacobi{
// jacobi(a,n)
public static void main(String[] args) {
int n = 234567,a = 97770;
if(n<=0 || (n %2) == 0)
return (0);
int temp, j=1;
if(a<0) {
a = -a;
if((n % 4) == 3)
j = -j;
}
do while (a!=0) {
do while(( a % 2)==0) {
/* Process factors of 2: Jacobi(2,b)=-1 if b=3,5 (mod 8) */
a=a/2;
if((n % 8)==3 || (n % 8) == 5) {
j = -j; }
}
/* Quadratic reciprocity: Jacobi(a,b)=-Jacobi(b,a) if a=3,b=3 (mod 4) */
temp = a;
a = n;
n = temp;
if((a % 4) == 3 && (n % 4) == 3){
j = -j;
}
a = a % n;
}
// here my code is showing,[ line just below, the one start with if(n==1) ],the illegal start of expression,
if(n == 1) {
return(j);
}
else return(0);
}
}