Write a method that is called setBit, which takes a byte, sets the kth bit of that byte from the right, and returns the output byte.

Note: You may only use the following operators: &, |, <<,>>, ~.

For example:

byte x = 173; //173 is 10101101 setBit(x, 2); //would return 10101111.

× How can I help you?