1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
RoseWind [281]
3 years ago
11

LAB: Convert to binary - methods

Computers and Technology
1 answer:
Georgia [21]3 years ago
8 0

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;

  }

 

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.

You might be interested in
Which of the following are examples of software? Check all of the boxes that apply.
dezoksy [38]

Hey!

------------------------------------------

<h3>Answers:</h3>

Operating System

Web Browser

Word Processor

Device Driver

------------------------------------------

<h3>Explanation:</h3>

Software is a set of data that tells the computer what to do. Each of the answer above tell the computer something specific to do.

The operating system are basic functions that make the computer run smoothly.

The web browser is telling the computer you want to look something up like in internet explorer, firefox, and chrome.

The word processor is a piece of software that tells the computer that you want to format a piece of text like in Microsoft word.

The device driver is a piece of software that controls a connected device like a phone or another computer.

------------------------------------------

Hope This Helped! Good Luck!

4 0
3 years ago
Read 2 more answers
Which directory holds most of the system log files?
faust18 [17]
I think the answer to that is /var/log hope this helps
5 0
3 years ago
What is an individual section machine?
irina1246 [14]
The most widely used forming machine arrangement is the individual section machine (or IS machine). This machine has a bank of 5–20 identical sections, each of which contains one complete set of mechanisms to make containers. ... Sections make either one, two, three or four containers simultaneously.
7 0
3 years ago
Write a program to input elements of 4*3matrix and prints its elements properly using array ​
Harlamova29_29 [7]

Answer:

Step by step explanation:

7 0
2 years ago
What was the purpose of the Internet Architecture Board?
Nata [24]

Answer:

c to help build the internets infrastrucuter

Explanation:

6 0
2 years ago
Read 2 more answers
Other questions:
  • The number of bits used to store color information about each pixel is called ____.
    13·1 answer
  • A geologist is part of what career feild
    6·1 answer
  • What is the input output ratio if its 12/23
    7·1 answer
  • During the charging of a storage battery, what is the temperature that the electrolyte solution must never exceed?
    6·1 answer
  • Put the following five steps in the order in which you would perform them to use the Paste Special function. 1. Select and copy
    6·1 answer
  • Name the months that have 30 days​
    6·2 answers
  • Explain the difference between undecidable problems and unreasonable time algorithms. Be specific.
    5·1 answer
  • What types of printed information are useful to obtain from your target employers?
    5·1 answer
  • I found a brand-new charger wire still in its plastic package, but it's six years old and has never been used. Is it safe to use
    9·1 answer
  • Visit on social networking site and look for the site's privacy policy.The link is typically found at the bottom of the page and
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!