Skip to content

Instantly share code, notes, and snippets.

@alorma
Created June 12, 2014 09:36
Show Gist options
  • Save alorma/48f7cd6fc4bb69209e34 to your computer and use it in GitHub Desktop.
Save alorma/48f7cd6fc4bb69209e34 to your computer and use it in GitHub Desktop.
private boolean checkMinVersion(String currentVersion) {
int[] currentVersionInts = convertToIntArray(currentVersion);
int[] minVersionInts = convertToIntArray(minimunVersion);
if ((currentVersionInts != null && currentVersionInts.length == 3) &&
(minVersionInts != null && minVersionInts.length == 3)) {
int majorC = currentVersionInts[0];
int minorC = currentVersionInts[1];
int patchC = currentVersionInts[2];
int majorM = minVersionInts[0];
int minorM = minVersionInts[1];
int patchM = minVersionInts[2];
boolean isMajor = majorC >= majorM;
boolean isMinor = minorC >= minorM;
boolean isPatch = patchC >= patchM;
return isMajor && isMinor && isPatch;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment