public static String extractDefaultMajorVersionFromPackageName(String packageName){
  String[] segs=packageName.split("\\.");
  String lastSeg=segs[segs.length - 1];
  Matcher matcher=MAJOR_VERSION_REGEX_PATTERN.matcher(lastSeg);
  if (matcher.find()) {
    return matcher.group(1);
  }
 else {
    return "v1";
  }
}

public static String extractDefaultMajorVersionFromPackageName ( String packageName ) { String [ ] segs = packageName . split ( "\\." ) ; String lastSeg = segs [ segs . length - 1 ] ; Matcher matcher = MAJOR_VERSION_REGEX_PATTERN . matcher ( lastSeg ) ; if ( matcher . find ( ) ) { return matcher . group ( 1 ) ; } else { return "v1" ; } }
extract major version from package name . the major version is reflected in the package name of the api , which must end in ` v { major - version } ` , as in ` google . feature . v1 ` . for major versions 0 and 1 , the suffix can be omitted . for that case , ` v1 ` is returned .
