nl_tokens: 本号比较 ( 例如1 . 10 . 0与1 . 2 . 0版本比较 ) 返回是否有新版本
pl_tokens: public static boolean hasNewVersion ( String oldVersion , String newVersion ) { //版本号有一个不正常就返回false if ( CBStringUtil . isEmptyOrNull ( oldVersion ) || CBStringUtil . isEmptyOrNull ( newVersion ) ) { return false ; } boolean res = false ; String [ ] oldVersionSnippet = oldVersion . split ( "\\." ) ; String [ ] newVersionSnippet = newVersion . split ( "\\." ) ; int maxComparePosition = Math . <mask> ( oldVersionSnippet . length , newVersionSnippet . length ) ; int i = 0 ; for ( ; i < maxComparePosition ; i ++ ) { int newNumber = Integer . parseInt ( newVersionSnippet [ i ] ) ; int oldNumber = Integer . parseInt ( oldVersionSnippet [ i ] ) ; if ( newNumber == oldNumber ) { continue ; } if ( newNumber > oldNumber ) { res = true ; break ; } if ( newNumber < oldNumber ) { res = false ; break ; } } //前面的都相等,比较长度 if ( i == maxComparePosition ) { res = newVersionSnippet . length > oldVersionSnippet . length ; } return res ; }