2023-12-19 16:57:13 +04:00

26 lines
592 B
Java

package Directions;
public enum CountWheels{
Min(2),
Mid(3),
Max(4);
private final int val;
private CountWheels(int val){
this.val = val;
}
public int getCountWheels(){
return val;
}
public static CountWheels fromNumberToEnum(int number) {
try{
for (CountWheels countWheels : CountWheels.values()) {
if (countWheels.getCountWheels() == number) {
return countWheels;
}
}
}catch(NumberFormatException e){
}
return Min;
}
}