Problem 4

/ Published in: Java

Project Euler Question 4:

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

Find the largest palindrome made from the product of two 3-digit numbers."

Output:

906609

`import java.util.*;    public class Prob4{      public static void main(String[] argsv){         System.out.println(largestPalindrome(100,1000));      }     // Searches for the largest numerical palindrone in the interval [start, end)      private static int largestPalindrome(int start, int end){         int high = 0;         for(int i = start; i < end; i++){            for(int j = start; j < end; j++){               if(isPalindrome(i * j) && ((i * j) > high)){                  high = i * j;               }            }         }         return high;      }       private static boolean isPalindrome(Integer n){         String s = n.toString();         return s.contentEquals(new StringBuffer(s).reverse());      }   }`