public static void main ( String [] args ) {
	int a, maxi = 0, maxj = 0, max = 0;
	String before, after;
	char temp;

	for ( int i=999; i>100; i--) {
	    for ( int j=999; j>100; j-- ) {
		a = i * j;
		before = Integer.toString(a);
		after = "";

		for ( int m = before.length()-1; m>=0; m-- ) {
		    temp = before.charAt(m);
		    after = after + temp;
		}

		if ( before.equals(after) ) {
		    if ( i*j > max ) {
			max = i * j;
			maxi = i;
			maxj = j;
		    }
		}
	    }
	}

	System.out.println("i="+maxi+", j=" + maxj + ", res=" + max);
    }