code: public static int getExponent(double d){
          /*
           * Bitwise convert d to long, mask out exponent bits, shift
           * to the right and then subtract out double's bias adjust to
           * get true exponent value.
           */
          return (int)(((Double.doubleToRawLongBits(d) & DoubleConsts.EXP_BIT_MASK) >>
                        (DoubleConsts.SIGNIFICAND_WIDTH - 1)) - DoubleConsts.EXP_BIAS);
      }
docs: Returns unbiased exponent of a {@code double}.