public static int compareVersionStrings(String version1,String version2) throws NumberFormatException {
  version1=SdkUtils.cleanupVersion(version1);
  version2=SdkUtils.cleanupVersion(version2);
  String splitRegex="[._-]";
  String[] array1=version1.split(splitRegex);
  String[] array2=version2.split(splitRegex);
  int n=Math.max(array1.length,array2.length);
  for (int i=0; i < n; i++) {
    int i1=parseVersionComponent(array1,i);
    int i2=parseVersionComponent(array2,i);
    if (i1 != i2) {
      return i1 - i2;
    }
  }
  return 0;
}

public static int compareVersionStrings ( String version1 , String version2 ) throws NumberFormatException { version1 = SdkUtils . cleanupVersion ( version1 ) ; version2 = SdkUtils . cleanupVersion ( version2 ) ; String splitRegex = "[._-]" ; String [ ] array1 = version1 . split ( splitRegex ) ; String [ ] array2 = version2 . split ( splitRegex ) ; int n = Math . max ( array1 . length , array2 . length ) ; for ( int i = 0 ; i < n ; i ++ ) { int i1 = parseVersionComponent ( array1 , i ) ; int i2 = parseVersionComponent ( array2 , i ) ; if ( i1 != i2 ) { return i1 - i2 ; } } return 0 ; }
compares two version strings for order . returns a negative integer , zero , or a positive integer if the first argument is less than , equal to , or greater than the second . < p > this method handles version strings that include rc or ms , treating them as ms < rc < final version .
