//TODO: this can be improved further to handle large powers
public static int raiseTo(int n, int p) {
    if (n == 0) {
      return 0;
    }
    if (p == 0) {
      return 1;
    }
    if (n == 1) {
      return n;
    }
    long result = n;
    int counter = 1;
    while (counter < p) {
      if (result * n >= Integer.MAX_VALUE) {
        return Integer.MAX_VALUE;
      }
      result *= n;
      counter++;
    }
    return (int) result;
  }
public static int raiseTo(int n, int p) {
if (n == 0) {
return 0;
}
if (p == 0) {
return 1;
}
if (n == 1) {
return n;
}
long result = n;
int counter = 1;
while (counter < p) {
if (result * n >= Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
}
result *= n;
counter++;
}
return (int) result;
}
public static int raiseTo(int n, int p) {
if (n == 0) {
return 0;
}
if (p == 0) {
return 1;
}
if (n == 1) {
return n;
}
long result = n;
int counter = 1;
while (counter < p) {
if (result * n >= Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
}
result *= n;
counter++;
}
return (int) result;
}
public static int raiseTo(int n, int p) {
if (n == 0) {
return 0;
}
if (p == 0) {
return 1;
}
if (n == 1) {
return n;
}
long result = n;
int counter = 1;
while (counter < p) {
if (result * n >= Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
}
result *= n;
counter++;
}
return (int) result;
}