1. String number = \"67\"; 2. int i = Integer.parseInt(number); 3. String by = I
ID: 3614360 • Letter: 1
Question
1. String number = "67";2. int i = Integer.parseInt(number);
3. String by = Integer.toBinaryString(i);
4. System.out.println("Binary:Encrypted Data: " + by);
1. What is the output?
2. What does Integer.parseInt exactly do?
3. What would be the result of changing 67 to Hello? Explain youranswer
4. Modify the given program above so that it takes the final resultin line 4 and converts it to an integer value of 3. You will needto add more lines of code to the provided code; lines 1 to 4 do NOTneed to be modified.
Explanation / Answer
please rate - thanks 1. What is the output? Binary:Encrypted Data: 1000011 2. What does Integer.parseInt exactlydo? It converts a string, in thiscase "67" into an integer 3. What would be the result of changing 67 to Hello? Explain youranswer It would get an error because "Hello" is not aninteger 4. Modify the given program above so that it takes the final resultin line 4 and converts it to an integer value of 3. You will needto add more lines of code to the provided code; lines 1 to 4 do NOTneed to be modified. I'm not sure what's being looked for, but this will work String number = "67"; int i = Integer.parseInt(number); String by = Integer.toBinaryString(i); System.out.println("Binary:Encrypted Data: " + by); i=i&3; System.out.println("67 anded with 3 is: " + i);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.