octal « Number « Java Data Type Q&A





1. how octal numbers can be print    coderanch.com

Since the way that you normally get digits in Octal is through Integer.toOctalString(), and that method does not support printing them in this way, you'll have to do something like the following: public class PrintOctals { public static void main( String[] args ) { int maxDigits = 3; for( int i = 0; i < 17; i++ ) { System.out.print( Integer.toString( ...

2. how to do octal number comparision    coderanch.com

Jesper is right... why do you need all those leading 0's? or why don't you use 0000000000000000000000000000000000000000000000000000008704 and 0000000000000000000000000000000000000000000000000000008999? because you don't need leading 0's. Therefore, when you put one on your number, Java assumes you are writing a number in base-8. The only allowed digits in base-8 are 0,1,2,3,4,5,6, and 7. You're numbers have the digit '8', so Java is ...

4. Octal number conversion    coderanch.com

Hi All, For integer if i want to specify hexadecimal number then max length can be 15 digits only. And i want to specify Octal number then max length can be 21 digits only. Can anybody tell me how internally java convert input number option1) hexadecimal -to- binary option2) octal -to- hexidecimal -to- binary Because for integer we can have upto ...