Java Trainer Puzzle 5.3.4

Class

class Puzzle {
  int n, pow2;
}

Puzzle

Assume that n is greater than zero. Write a statement to set pow2 to the greatest power of 2 less than or equal to n. (Don't change n.) This puzzle was solved for you in the text of Lab Five; but try to solve it again now on your own.

Solution

Your browser does not support the Java necessary for this exercise.