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
What element is not a selection in the Interface preferences? UI Character Presets UI Font Size UI Language UI Scaling
Dovator [93]

Answer:

The element is not a selection in the Interface preferences is:

UI Character Presets

Explanation:

The interface preferences is a  section of the Set Preferences dialog, which contains settings related to the user interface for the display and configuration of certain features and dialogs, in accordance with the user's preferences.  They include the UI Font Size, UI Language, and UI Scaling, with the exception of the the UI Character Presets.  The UI Scale is the frontend extension of the actual screen resolution to the user.  The UI Language configures the user's preferred language, just as the UI Font Size allows the user to choose a preferred font size for display on the screen.

6 0
3 years ago
Which of the following shows a list of Big-Oh running times in order from slowest to fastest?
Rufina [12.5K]

Answer:

O(N!), O(2N), O(N2), O(N), O(logN)

Explanation:

N! grows faster than any exponential functions, leave alone polynomials and logarithm. so O( N! ) would be slowest.

2^N would be bigger than N². Any exponential functions are slower than polynomial. So O( 2^N ) is next slowest.

Rest of them should be easier.

N² is slower than N and N is slower than logN as you can check in a graphing calculator.

NOTE: It is just nitpick but big-Oh is not necessary about speed / running time ( many programmers treat it like that anyway ) but rather how the time taken for an algorithm increase as the size of the input increases. Subtle difference.

5 0
2 years ago
Read 2 more answers
3.5 Code Practice: Question 1<br> (Website: Edhesive)
igor_vitrenko [27]
Sorry the website wasn’t working for me
3 0
2 years ago
Help!! Best answer will get Brainliest!!
Eddi Din [679]

Answer:

answer(s):

-set goals

-select a topic

-write down research questions

Hope this helped and sorry for the bold. <3

Explanation:

6 0
2 years ago
Read 2 more answers
152<br>what is the role of Computer as<br>transforming agent in the<br>Information society.​
hichkok12 [17]
I have a question what grade are you in
8 0
2 years ago
Other questions:
  • What is a major plastics engineering project that is going on right now in Arizona?
    9·1 answer
  • Mica's creating his web page with a software that is free of charge for the first month. If he likes the program, he will have t
    8·2 answers
  • Psychographics may also be called A. personality analytics. B. social group dynamics. C. lifestyle analysis. D. opinion insight.
    6·1 answer
  • Plymouth Colony was originally founded by a group of people called Pilgrims. Since Plymouth did not have an official charter fro
    15·1 answer
  • True or False: The major advantage of Arrays over ArrayLists in Java is the fact that while ArrayLists are fixed in size, an Arr
    15·1 answer
  • The microprogram counter (MPC) contains the address of the next microcode statement for the Mic1 emulator to execute. The MPC va
    12·1 answer
  • Which is the first computer brought in nepal for the census of 2028 B.S​
    6·1 answer
  • Are there any Potential Dangers in Artificial Intelligence?
    11·2 answers
  • What economic impact will this disaster have on people? Select three options.
    11·1 answer
  • In which number system do the digital computer work​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!