Пример #1
0
  public static FigureType getTypeByIntVal(int val) {
    for (FigureType type : FigureType.values()) {
      if (type.getValue() == val) {
        return type;
      }
    }

    return null;
  }
Пример #2
0
 public static FigureType randomType() {
   return getTypeByIntVal(new Random().nextInt(FigureType.values().length) + 1);
 }