How did it become octal? Plss explain it to me. Thanks
String number = "10001"; int bnum = Integer.parseInt(number, 2); String octal = Integer.toOctalString(bnum); System.out.println(octal);
You have a string variable 'number' which stores a string representing a binary number. Integer.parseInt(number, 2); tells the program to parse the string to an integer value, and that the string represents a value in base 2 (binary). At this point, bnum would store the value 17 (from base 10 viewpoint, since 10001 in binary is 17 in decimal). Integer.toOctalString(bnum); converts the value in bnum to a string which represents the value of bnum in octal (base 8). 17 in base 8 is 21.
Hatsy Rei Oh I see, Thank you for explaining. I'm new in programming so I really don't know. Thanks again. :)
I have made a calculator in which my % (Percentage) not work correctly for 100%50 or 100%20.
Python palindrome challenge.
I have a problem in html in the third practice in the third lesson there is a cv project how will I do they said wrap the code u