public static long nextPowerOfTwo ( long x ) { if ( x == 0L ) { return 1L ; } else { -- x ; x |= x >> 1 ; x |= x >> 2 ; x |= x >> 4 ; x |= x >> 8 ; x |= x >> 16 ; return ( x | x >> 32 ) + 1L ; } }
Return the least power of two greater than or equal to the specified value .