Question: Java. In Java, write the following method: public static int decToBin(int decimal) The method accepts a decimal integer and returns its binary equivalent. (You have
Java.
In Java, write the following method: public static int decToBin(int decimal) The method accepts a decimal integer and returns its binary equivalent. (You have to do the conversion mathematically like we did in class. You can not use strings, vectors, arrays and the like.)
Why is writing the above method utterly meaningless, and it can be argued that the assignment is not very well worded?
Given: int num=-500; System.out.print(num+ +(byte) num ); What is printed? Given what you have learned in class about the number representation including the two's complement, how can you explain the output? Put the answers in the comments in your file.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
