Computer Science, asked by abhijeetzgd, 8 months ago

you will be given a variable list of unknown length containing 32 bit unsigned integers.you are required to give output a comma separated list,showing for each elements in the list the enteger you get by reversing bits in its binary representation.for example ,if list is 32768,101200 and 262144, you are expected to give as output 65536 ,18151952 and 8192. integers in the list will be given one per line

Answers

Answered by siddhiswarpatil
0

Answer:

I can't understand your question

please type in Hindi language

so I understand

Explanation:

please follow

me and

mark as

branily

I can't understand your question

please type in Hindi language

so I understand

Answered by ravilaccs
0

Answer:

The java program is constructed

Explanation:

Given a non-negative integer n. The problem is to reverse the bits of n and print the number obtained after reversing the bits. Note that the actual binary representation of the number is being considered for reversing the bits, no leading 0’s are being considered.

Examples :

Input : 11

Output : 13

(11)10 = (1011)2.

After reversing the bits we get:

(1101)2 = (13)10.

Input : 10

Output : 5

(10)10 = (1010)2.

After reversing the bits we get:

(0101)2 = (101)2

       = (5)10.

In this approach, one by one bit in the binary representation of n is being obtained with the help of bitwise right shift operation and they are being accumulated in rev with the help of bitwise left shift operation.

Program:

import java.util.*;

public class Convert{

    public static void main(String []args){

       Scanner sc=new Scanner(System.in);

       int input;

       String separator="";

       while(sc.hasNextInt())

       {

           input=sc.nextInt();

           System.out.print(separator+Integer.reverse(input));

           separator=", ";            

       }

    }

}

Similar questions