### java

#### Tail Recursive function

```So I just started learning about recursion and tail recursion.
I've been looking at some methods and have two here for doing to the power of.
The recursive function is fine but I have no idea what is going on in the tail recursive function, can anyone explain?
public static int n_toThePowerof_m(int n, int m){
if(m <0){
throw new IllegalArgumentException("Illegal Arguement");
}
else if (m == 0){
return 1;
}
else{
return n * n_toThePowerof_m(n, m-1);
}
}
public static int n_toThePowerof_mTail(int n, int m, int accum){
while(n !=0 ){
if((n&0x01) != 0x00){
accum *= m;
}
m >>>= 0x01;
m *= m;
}
return accum;`
}
```
```I agree with #cricket_007 the second method would be considered as the induction step (also has a base case (while (n!=0)) or maybe just the iteration step but definitely not recursion (function must call self in body for recursion).
hope that helps !```

### Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization