[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Program Discussion :: Bitwise Operator

Home > Programs > Bitwise Operator

13 / 15

Write an efficient program to set the bits in a given range(start and end position given) in an integer number

Answer:

import java.util.*;
import java.lang.*;
import java.io.*;

class SetBits
{
    public
      int start;
      int end;
      int num;


public
 SetBits(int s, int e, int n)
 {
     start = s;
    end = e;
    num = n;
 }

  void set()
  {
    for (int i = start; i

Asked In ::

Post Your Answer Here:

Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here: