示例#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);
 }