title: Largest palindrome product - euler project
body: <p>I was trying to solve project Euler <a href="http://projecteuler.net/problem=4" rel="nofollow">problem 4</a> which is:</p>
  
  <p><strong><em>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.</em></strong></p>
  
  <p>Here is my solution , it's output is 997799 , however that's not the correct answer ,I wonder where is the problem:</p>
  
  <pre><code>package projecteuler;
  
  public class Pro4 {
  
      public static void main(String[] args) {
  
          for(int i=999*999;i&gt;=100*100;i--){
              if(isPalindrome(i)==true){
                  System.out.println(i);
                  break;
              }
          }
      }
  
      static boolean isPalindrome(int x){
          int[] bits = new int[7];
          int index=1;
          while(x&gt;0){
              bits[index]=x%10;
              index++;
              x/=10;
          }
          for(int i=1;i&lt;=index/2;i++){
              if(bits[i]!=bits[index-i]){
                  return false;
              }
          }
          return true;
      }
  
  }
  </code></pre>