java: public static Format byId(int id) {for (Format format : Format.values()) {if (format.getId() == id) {return format;}}throw new IllegalArgumentException("Unknown format id: " + id);}
C#: public static Format ById(int id){foreach (Format format in Values){if (format.Id == id){return format;}}throw new ArgumentException("Unknown format id: " + id);}