I have below code
int a = 01111;
System.out.println("output1 = " + a);
System.out.println("output2 = " + Integer.toOctalString(1111));
and output is
output1 = 585 output2 = 2127
I was expecting output to be like below.
output1 = 2127 output2 = 2127
Why does it give 585
when I print direct int value ? I was expecting java to automatically convert value with leading zero to octal.
What is the relation between 01111
and 585
?