public static Number power(Number self,Number exponent){
  double base, exp, answer;
  base=self.doubleValue();
  exp=exponent.doubleValue();
  answer=Math.pow(base,exp);
  if ((double)((int)answer) == answer) {
    return (int)answer;
  }
 else   if ((double)((long)answer) == answer) {
    return (long)answer;
  }
 else {
    return answer;
  }
}

public static Number power ( Number self , Number exponent ) { double base , exp , answer ; base = self . doubleValue ( ) ; exp = exponent . doubleValue ( ) ; answer = Math . pow ( base , exp ) ; if ( ( double ) ( ( int ) answer ) == answer ) { return ( int ) answer ; } else if ( ( double ) ( ( long ) answer ) == answer ) { return ( long ) answer ; } else { return answer ; } }
power of a number to a certain exponent . called by the ' * * ' operator .
