@Override
    public long power(long element, long exponent) {
        isInField(element);

        if (exponent < 0) {
            throw new MathIllegalArgumentException("Cannot compute power with negative exponent!");
        }

        if (exponent == 0 && element != 0) {
            return 1l;
        }

        if (exponent == 0 && element == 0) {
            return 0l;
        }

        long result = 1;
        long a = element;
        long x = exponent;

        while (x != 1) {
            if ((x % 2) == 1) {
                result = multiply(result, a);
            }
            x /= 2;
            a = multiply(a, a);
        }

        return multiply(result, a);
    }