예제 #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);
 }