Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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