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; }