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]
2 years ago
11

LAB: Convert to binary - methods

Computers and Technology
1 answer:
Georgia [21]2 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
How could the provisions in the new health reform bill improve access to care?
VashaNatasha [74]
The Affordable Care Act will significantly change health coverage and care, bringing us closer to the goal of high-quality, affordable health insurance for all Americans. The law:

expands Medicaid to more low-income Americans
creates health insurance marketplaces (also known as "exchanges") where consumers can buy high-quality, affordable private plans
protects consumers by eliminating coverage denials for people with pre-existing conditions, requiring health insurance companies to spend the majority of premium dollars on health care, offering free preventive services, and more
4 0
3 years ago
I love dog my is 16 weeks old how old is yours
attashe74 [19]
I don't like dogs so I don't have one but if I did I think it would have been dead anyway
5 0
3 years ago
If there is a mistake with one of your bank accounts, who should you contact to resolve the issue
Reika [66]

Answer:

I would advise calling the bank as they are the probably the most likely to be able to resolve the issue .

6 0
3 years ago
What is the function of a primary key in a table? to uniquely identify each record in the table to uniquely identify foreign key
aev [14]

Answer:

A. To uniquely identify each record in the table

brainliest pls?

6 0
2 years ago
18. Applying what formatting option to your Excel workbook will make it easier to read when printed out?
Sergeu [11.5K]
Depending on the data all answers can be used to make it easier to read. Without more info I would go with Borders (D) since they are the best way to group the data when printed, especially if the print is in color.

Alignment would be the correct answer only if the data goes out of cell boundaries. Font Color usually makes it harder to read because of bad contrast and finally changing the Font Style has a minimal effect since the default one is already pretty readable.
7 0
3 years ago
Other questions:
  • Write a complete program to do the following: The main program calls a method to read in (from an input file) a set of people's
    12·1 answer
  • You are in charge of designing a menu tree for navigating 1,250 books in a digital library. Present an argument of whether the m
    12·1 answer
  • Which is an example of an input device?
    15·2 answers
  • Your browsing the Internet and realize your browser is not responding which of the following will allow you to immediately exit
    14·2 answers
  • Why is brainly not working it say im logged out rn but im not i cant acces anything but this
    12·2 answers
  • (d) What other services beside cloud-based software may be provided by Internet hosts?[1]
    11·1 answer
  • I was killed <br><br> යඞ <br><br> what do i do
    10·1 answer
  • Please could you help me
    6·2 answers
  • What would provide structured content that would indicate what the code is describing ?
    6·1 answer
  • Lab 8-1: Working with Boot Loader and Runlevels what is the root password
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!