## Problem Description :

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers?

## Concept :

A palindromic number or numeral palindrome is a number that remains the same when its digits are reversed. For example 99 is a palindrome but 89 is not.

## Java Program :

```package com.javamultiplex.projecteuler;

/**
*
* @author Rohit Agarwal
* @category Project Euler Problems
* @problem Largest palindrome product
*
*/
public class Problem4 {

public static void main(String[] args) {

int maxThreeDigit = 999;
int minThreeDigit = 100;
int multInteger = 0;
// lowest multiple of 2 three digit numbers
int max = 100 * 100;
for (int i = maxThreeDigit; i >= minThreeDigit; i--) {
for (int j = i; j >= minThreeDigit; j--) {
multInteger = i * j;

// Checking multiplication is palindrome or not
if (isPalindrome(multInteger)) {
if (multInteger > max) {
max = multInteger;
break;
}
}
}
}
System.out.println("Largest palindrom made from the product of two 3-digit numbers is: "
+ max);
}

private static boolean isPalindrome(int multInteger) {

boolean result = false;
String multString = null;
StringBuffer multStringBuffer = null;
// Converting Integer to String
multString = String.valueOf(multInteger);
/*
* Converting String to StringBuffer, We want to reverse the string
* thats why we have to use StringBuffer.
*/
multStringBuffer = new StringBuffer(multString);
if (multString.equals(multStringBuffer.reverse().toString())) {
result = true;
} else {
result = false;
}
return result;
}

}
```

## Output :

 Output - Project Euler Problem 4

## References :

https://projecteuler.net/problem=4

https://en.wikipedia.org/wiki/Palindromic_number

https://docs.oracle.com/javase/7/docs/api/java/lang/String.html

https://docs.oracle.com/javase/7/docs/api/java/lang/StringBuffer.html

Thank you friends, I hope you have clearly understood the solution of this problem. If you have any doubt, suggestion or query please feel free to comment below. You can also discuss this solution in our forum.

Tags : Project Euler Problem 4, Solution in Java, Mathematics problems, Largest palindrome product, if else statement, for loop, String, StringBuffer.