title: Java conversion from binary to octal
body: <p>So I have this code for converting a binary to octal. I want to convert up to 64 bits of binary but it doesn't work.</p>
  
  <p>What should I do?</p>
  
  <pre><code>String result=""; 
  int i; 
  long a[]=new long[100]; 
  String input="11111111111111111111111111111111111111111111111";
  i=0;
  for(i=input.length();i&gt;0;i-=3){
      a[i]=Long.parseLong(input.substring(i-3,i));
      if(a[i]==0) result+="0";
      else if(a[i] == 1) result += "1";
      else if(a[i]==10) result+="2";
      else if(a[i]==11) result+="3";
      else if(a[i]==100) result+="4";
      else if(a[i]==101) result+="5";
      else if(a[i]==110) result+="6";
      else if(a[i]==111) result+="7";
  }
  System.out.print(result);
  </code></pre>