code: public static double intPow(double b, int e) {
      double result = 1.0;
      double currPow = b;
      while (e > 0) {
        if ((e & 1) != 0) {
          result *= currPow;
        }
        currPow *= currPow;
        e >>= 1;
      }
      return result;
    }
docs: Exponentiation like we learned in grade school:
  multiply b by itself e times.  Uses power of two trick.
  e must be nonnegative!!!  no checking!!!
  @param b base
  @param e exponent
  @return b^e