title: How find given number is octal or not?
body: <p>In this I find octal number upto 3 digits and i use lengthy if conditions can anyone lessen this if statement and values assigned. Note that don't use prdefined process or inbuilt packages..</p>
  
  <pre><code>import java.util.Scanner;
  class octdec
  {
  public static void main(String arg[])
      {
      int back=0;
      do
          {
          Scanner ip = new Scanner(System.in);
          int no,mod1,mod2,mod3,diff1,diff2,diff3,num1,num2,num3;
          System.out.print("Enter Octal No upto 3 digits : ");
          no=ip.nextInt();
          mod1=no%10;
          mod2=no%100;
          mod3=no%1000;
          diff1=no-mod1;
          diff2=no-mod2;
          diff3=no-mod3;
          num1=diff1/10;
          num2=diff2/100;
          num3=diff3/1000;
          if(no==8||no==9||mod1==8||mod1==9||mod2==8||mod2==9||mod3==8||mod3==9||num1==8||num1==9||num2==8||num2==9||num3==8||num3==9)
          System.out.println("Invaild Octal Nimber ");
          else
          System.out.println("Vaild Octal Nimber :"+no);
          }
      while(back==0);
      }
  }
  </code></pre>