title: How to print all palindromes upto 1000 without using any String,StringBuilder?
body: <p>I have to write a code for printing all palindrome numbers up to 1000. Here is my code. I have dealt with 3 scenarios:</p>
  
  <ol>
  <li>1-digit number</li>
  <li>2-digit number</li>
  <li>3-digit number</li>
  </ol>
  
  <p>My third scenario is not printing just the palindromes but prints all the numbers. A hint will help me solve this.</p>
  
  <pre><code>public class PrintPalindrome {
  public static void main(String args[])
  {
      Integer[] array=new Integer[1000];
      for(int i=0;i&lt;array.length;i++)
      {
          array[i]=i+1;
          printPalindrome(array[i]);
          //System.out.println(array[i]);
      }
  }
  
  public static void printPalindrome(Integer a)
  {
      String num=Integer.toString(a);
      int length=num.length()-1;
      //System.out.println(num);
      if(num.length()&lt;=1)
      {
          System.out.println("" + num);
  
      }
      else if(num.length()==2)
      {
          if(num.charAt(0)==num.charAt(1))
  
              System.out.println(num);
  
      }
      else if(num.length()&gt;2)
      {
          //now deal with the numbers whose length is greater than 2
          for(int i=0;i&lt;=length;i++)
          {
              if(num.charAt(i)==num.charAt(length-i))
                  System.out.println(num);
  
  
          }
      }
  
  
  }
  }
  </code></pre>