question: private static int compareVersion ( String versionStr1 , String versionStr2 ) { if ( versionStr1 == null ) { throw new MLContextException ( "First version argument to compareVersion() is null" ) ; } if ( versionStr2 == null ) { throw new MLContextException ( "Second version argument to compareVersion() is null" ) ; } Scanner scanner1 = null ; Scanner scanner2 = null ; try { scanner1 = new Scanner ( versionStr1 ) ; scanner2 = new Scanner ( versionStr2 ) ; scanner1 . useDelimiter ( "\\." ) ; scanner2 . useDelimiter ( "\\." ) ; while ( scanner1 . hasNextInt ( ) && scanner2 . hasNextInt ( ) ) { int version1 = scanner1 . nextInt ( ) ; int version2 = scanner2 . nextInt ( ) ; if ( version1 < version2 ) { return - 1 ; } else if ( version1 > version2 ) { return 1 ; } } return scanner1 . hasNextInt ( ) ? 1 : 0 ; } finally { scanner1 . close ( ) ; scanner2 . close ( ) ; } }
target:  Compare two version strings (ie, "1.4.0" and "1.4.1").