question: 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 ; }
target:  Compare 2 version number Strings. Version String which cannot be translated to an Integer will be considered 0.