0

I'm developing a program based on the Tower of Hanoi. It accepts the number of discs and returns the amount of turns it takes for those discs to complete the conundrum. All of my inputs work fine, until the input (d) is greater than 31. Is the result too large to return?

```
package numTurns;
/**
*
* @author Josh
*/
public class Main {
public static int numTurns (int d) {
int turns = 1;
if (d == 0) {
return 0;
} if ( d == 1) {
return 1;
// returns 1 if d == 1
}
for (int i = 1; i < d; i++) {
turns = turns * 2 + 1;
}
return turns;
// returns number of turns only if d is greater than 1
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// Tests
System.out.println (numTurns (3));
System.out.println (numTurns(4));
System.out.println (numTurns(32));
}
}
```