String (@Nullable String versionString) { final String prefix = "Python "; if (versionString != null && versionString.startsWith(prefix)) { final String version = versionString.substring(prefix.length()); int dot = version.indexOf('.'); if (dot > 0) { dot = version.indexOf('.', dot + 1); if (dot > 0) { return version.substring(0, dot); } return version; } } return null; }