public static boolean versionSatisfiesMinimum ( int [ ] minimumVersion , int [ ] queryVersion ) { if ( minimumVersion . length == queryVersion . length ) { for ( int i = 0 ; i < minimumVersion . length ; i ++ ) { //Start at most significant digit if ( queryVersion [ i ] < minimumVersion [ i ] ) { //This is too small, so fail. We're moving in from the most significant end, so no point in continuing return false ; } else if ( queryVersion [ i ] == minimumVersion [ i ] ) { //This one is the same, so we must continue and check the other digits. continue ; } else if ( queryVersion [ i ] > minimumVersion [ i ] ) { //This one is bigger. We're moving in from the most significant end, so the other bits don't matter now. return true ; } } //We got to the end without breaking any rules, so it is valid. return true ; } return false ; }
Evaluate whether queryVersion is considered to be greater or equal than minimumVersion .