Answer:
import java.util.Scanner;
public class Lab{
public static String integerToReverseBinary(int number)
{
String binary = "";
if(number == 0){
return "0";
}
while(number > 0)
{
int remainder = number % 2;
number = number / 2;
binary += Integer.toString(remainder);
}
return binary;
}
public static String reverseString(String wordString)
{
String binaryString = "";
int length = wordString.length();
for(int i = length -1 ; i >= 0 ; i--)
{
binaryString += wordString.charAt(i);
}
return binaryString;
}
Step-by-step explanation:
In the java source code, the Lab class is defined which has two methods, 'reverseString' and 'integerToReverseBinary'. The latter gets the argument from the former and reverses the content of its string value, then returns the new string value. The former gets the integer value and converts it to its binary equivalence for which are converted to strings and returned.