private static Object cast(@NotNull Object operand, @TypeRank int rankTo) {
    Number number = operand instanceof Character ? Integer.valueOf((Character)operand)
                                                 : operand instanceof Number ? (Number)operand : null;
    if (number == null) return null;
    switch (rankTo) {
      case BYTE_RANK:
        return number.byteValue();
      case SHORT_RANK:
        return number.shortValue();
      case CHAR_RANK:
        return (char)number.intValue();
      case INT_RANK:
        return number.intValue();
      case LONG_RANK:
        return number.longValue();
      case FLOAT_RANK:
        return number.floatValue();
      case DOUBLE_RANK:
        return number.doubleValue();
      default:
        return null;
    }
  }
private static Object cast(@NotNull Object operand, @TypeRank int rankTo)