Question: ```
package testing.project;

public class PalindromeThreeDigits {

    public static void main(String[] args) {
        int value = 0;
        for(int i = 100;i <=999;i++)
        {
            for(int j = i;j <=999;j++)
            {
                int value1 = i * j;
                StringBuilder sb1 = new StringBuilder(""+value1);
                String sb2 = ""+value1;
                sb1.reverse();
                if(sb2.equals(sb1.toString()) && value<value1) {
                    value = value1;

                }

            }
        }

        System.out.println(value);
    }
}

```

This is the code that I wrote in Java... Is there any efficient way other than this.. And can we optimize this code more??

Answer: 
```
 package ex;

    public class Main {

        public static void main(String[] args) {
            int i = 0, j = 0, k = 0, l = 0, m = 0, n = 0, flag = 0;

            for (i = 999; i >= 100; i--) {
                for (j = i; j >= 100; j--) {
                    k = i * j;

                    // System.out.println(k);
                    m = 0;
                    n = k;

                    while (n > 0) {
                        l = n % 10;
                        m = m * 10 + l;
                        n = n / 10;
                    }

                    if (m == k) {
                        System.out.println("pal " + k + " of " + i + " and" + j);
                        flag = 1;
                        break;
                    }
                }

                if (flag == 1) {
                    // System.out.println(k);
                    break;
                }
            }
        }
    }   

```
Most probably it is replication of one of the other solution but it looks simple owing to pythonified code ,even it is a bit brute-force.

```
def largest_palindrome():
    largest_palindrome = 0;
    for i in reversed(range(1,1000,1)):
        for j in reversed(range(1, i+1, 1)):
            num = i*j
            if check_palindrome(str(num)) and  num > largest_palindrome :
                largest_palindrome = num 
    print "largest palindrome ", largest_palindrome

def check_palindrome(term):
    rev_term = term[::-1]
    return rev_term == term

```