private int compareVersion(String s1, String s2) { String[] ss1 = s1.split("\\."); String[] ss2 = s2.split("\\."); for (int i = 0; i < Math.max(ss1.length, ss2.length); i++) { String v1 = "0",v2 = "0"; if(i < ss1.length){ v1 = getV(ss1[i]); } if(i < ss2.length){ v2 = getV(ss2[i]); } if(v1.compareTo(v2) != 0){ return v1.compareTo(v2) > 0 ? 1 : -1; } } return 0; }