public static boolean compareVersion(String newVersion, String currVersion)
{
if (newVersion.equalsIgnoreCase(currVersion)) {
return false;
}
String[] news = newVersion.split("\\.");
String[] currs = currVersion.split("\\.");
int max = Math.max(news.length, currs.length);
for (int i = 0; i < max; i++) {
if (news.length <= i) return false;
else if (currs.length <= i) return true;
int newI = Integer.parseInt(news[i]);
int currsI = Integer.parseInt(currs[i]);
if (newI - currsI < 0) {
return false;
} else if (newI - currsI > 0 ){
return true;
} else {
continue;
}
}
return false;
}
{
if (newVersion.equalsIgnoreCase(currVersion)) {
return false;
}
String[] news = newVersion.split("\\.");
String[] currs = currVersion.split("\\.");
int max = Math.max(news.length, currs.length);
for (int i = 0; i < max; i++) {
if (news.length <= i) return false;
else if (currs.length <= i) return true;
int newI = Integer.parseInt(news[i]);
int currsI = Integer.parseInt(currs[i]);
if (newI - currsI < 0) {
return false;
} else if (newI - currsI > 0 ){
return true;
} else {
continue;
}
}
return false;
}