code: public int power(int x, int n) {
      assert(x >= 0 && x < getFieldSize());
      if (n == 0) {
        return 1;
      }
      if (x == 0) {
        return 0;
      }
      x = logTable[x] * n;
      if (x < primitivePeriod) {
        return powTable[x];
      }
      x = x % primitivePeriod;
      return powTable[x];
    }
docs: Compute power n of a field
  @param x input field
  @param n power
  @return x^n