Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java Script An Integer object will be passed to your method. Convert it to a Binary String and then return the String. To convert an
Java Script
An Integer object will be passed to your method. Convert it to a Binary String and then return the String. To convert an Integer into a string that looks like a binary number, use the Integer.toBinaryString) method. You put the name of the Integer object that you want converted inside the parentheses. 1- import java.util. Random; import java.util.Stringjoiner; 4- public class preLabc { 5 public static String myMethod(Integer myInteger) { 8 String StringInteger InBinaryForm = new String(); 9 10 11 // Output a string. It's the binary form of myInteger. // If my Integer is 3, then stringInteger InBinaryForm = 11 13 // use the Integer.toBinaryString(PutintegerobjectHere) method. 14 StringInteger InBinaryForm = ... // fix this here. 15 16 system.out.println("The Integer " + my Integer + " in Binary is " + stringInteger InBinaryForm); 17 18 // return the string here... return ... // fix this... 20 21 } What does a binary number look like? O is 0. 1 is 1. The number 2? It's 10. And three? It's 11. Seven is 111. Eight is 1000. What to reproduce this on your own machine? Here are some important files: * preLabC.java (fill this in) MyTest.java (the JUnit testing file. Student can use this on their own computer if they wish) 23 01Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started