class IntUtils {

  /**
   * Returns an appropriate integer for a given maximum element.
   * 
   * Throws an exception in case of an unsupported size.
   * 
   * @param maxValue
   *          the max value
   * @return the integer
   */
  public static IntegerType getTypeByWidth(int maxValue) {<FILL_FUNCTION_BODY>}

  /**
   * Returns the maximum value an integer type can have.
   * 
   * @param t
   *          the integer type
   * @return the maximum value
   */
  public static int getMaxValue(IntegerType t) {
    if (t instanceof Integer1Type || t instanceof BooleanType) {
      return 1;
    }
    if (t instanceof Integer127Type || t instanceof ByteType) {
      return 127;
    }
    if (t instanceof Integer32767Type || t instanceof ShortType || t instanceof CharType) {
      return 32767;
    }
    if (t instanceof IntType) {
      return Integer.MAX_VALUE;
    }
    throw new RuntimeException("Unsupported type: " + t);
  }

}

    switch (maxValue) {
      case 1:
        return Integer1Type.v();
      case 127:
        return Integer127Type.v();
      case 32767:
        return Integer32767Type.v();
      case Integer.MAX_VALUE:
        return IntType.v();
      default:
        throw new RuntimeException("Unsupported width: " + maxValue);
    }
  
<no_super_class>