public static void main ( String [] args ) {
	int n=0, counter=0, maxa=0, maxb=0, maxcounter=0;
	boolean flag = true;
	
	for ( int a=-999; a<1000; a++ ) {
	    for ( int b=-999; b<1000; b++ ) {
		counter = 0;
		n = 0;
		flag = true;
		while ( isPrime(n*n+a*n+b) == true ) {
		    n++;
		    counter++;
		    if ( counter > maxcounter ) {
			maxa = a;
			maxb = b;
			maxcounter = counter;
		    }
		}		
	    }
	}

	System.out.println("a="+maxa+", b="+maxb+", n="+maxcounter+", product="+(maxa*maxb));
    }