private int compareVersionParts(String version1,String version2){
  int compare=0;
  Integer v1;
  Integer v2;
  try {
    v1=version1 != null ? Integer.parseInt(version1) : 0;
  }
 catch (  NumberFormatException e) {
    v1=0;
  }
  try {
    v2=version2 != null ? Integer.parseInt(version2) : 0;
  }
 catch (  NumberFormatException e) {
    v2=0;
  }
  if (v1 > v2) {
    compare=1;
  }
 else   if (v1 < v2) {
    compare=-1;
  }
 else {
    compare=0;
  }
  return compare;
}

private int compareVersionParts ( String version1 , String version2 ) { int compare = 0 ; Integer v1 ; Integer v2 ; try { v1 = version1 != null ? Integer . parseInt ( version1 ) : 0 ; } catch ( NumberFormatException e ) { v1 = 0 ; } try { v2 = version2 != null ? Integer . parseInt ( version2 ) : 0 ; } catch ( NumberFormatException e ) { v2 = 0 ; } if ( v1 > v2 ) { compare = 1 ; } else if ( v1 < v2 ) { compare = - 1 ; } else { compare = 0 ; } return compare ; }
compare 2 version number strings . version string which cannot be translated to an integer will be considered 0 .
