code: public static long nextAllOnesLong(long x) {
      x |= x >>> 1;
      x |= x >>> 2;
      x |= x >>> 4;
      x |= x >>> 16;
      x |= x >>> 32;
      return x;
    }
docs: Find the next larger number with all ones.
  <p>
  Classic bit operation, for signed 64-bit. Valid for positive integers only
  (-1 otherwise).
  
  @param x original long integer
  @return Next number with all bits set