Version (@Nullable String ver) { int major = -1, minor = -1; final int dot = ver == null ? -1 : ver.indexOf('.'); if (dot > 0) { major = Integer.parseInt(ver.substring(0, dot)); minor = Integer.parseInt(ver.substring(dot + 1)); } return major < 0 || minor < 0 ? UNKNOWN : new Version(major, minor); }