Java recursive exponent function.