import static java.lang.System.out;

public class BitTwiddling
{
  public static void main( String[] args )
  {
    out.println( Long.highestOneBit( 8 - 1 ) );                 // 4
    out.println( Long.lowestOneBit( 2 + 4 ) );                  // 2
    out.println( Long.numberOfLeadingZeros( Long.MAX_VALUE ) ); // 1
    out.println( Long.numberOfLeadingZeros( -Long.MAX_VALUE ) );// 0
    out.println( Long.numberOfTrailingZeros( 16 ) );            // 4
    out.println( Long.numberOfTrailingZeros( 3 ) );             // 0
    out.println( Long.bitCount( 8 + 4 +1 ) );                   // 3
    out.println( Long.rotateLeft( 12, 1 ) );                    // 24
    out.println( Long.rotateRight( 12, 1 ) );                   // 6
    out.println( Long.reverse( Long.MAX_VALUE ) );              // -2
    out.println( Long.reverse( 0x0F00000000000000L ) );         // 240
    out.println( Long.reverseBytes( 0x0F00000000000000L ) );    // 15
  }
}
