@@ -0,0 +1,1797 @@
+/**%09Compare two version numbers version1 and version2.%0A *%09If version1 %3E version2 return 1, if version1 %3C version2 return -1, otherwise return 0.%0A *%0A *%09You may assume that the version strings are non-empty and contain only digits and the . character.%0A *%09The . character does not represent a decimal point and is used to separate number sequences.%0A *%09For instance, 2.5 is not %22two and a half%22 or %22half way to version three%22, %0A *%09it is the fifth second-level revision of the second first-level revision.%0A *%0A *%09Here is an example of version numbers ordering:%0A *%0A *%090.1 %3C 1.1 %3C 1.2 %3C 13.37%0A *%0A *%09Author: matao%0A *%0A */%0A%0Apublic class CompareVersionNumbers %7B%0A%09public static int compareVersion(String version1, String version2) %7B%0A        String%5B%5D s1 = version1.split(%22%5B.%5D%22);%0A        String%5B%5D s2 = version2.split(%22%5B.%5D%22);%0A        if(s1.length %3C s2.length)%0A        %09return -1 * compareVersion(version2, version1);%0A        int v1, v2;%0A        for (int i = 0; i %3C s1.length; i++) %7B%0A%09%09%09v1 = Integer.parseInt(s1%5Bi%5D);%0A        %09if(i %3E= s2.length)%0A%09%09%09%09v2 = 0;%0A        %09else%7B%0A        %09%09v2 = Integer.parseInt(s2%5Bi%5D);%0A        %09%7D%0A        %09if (v1 %3C v2) %7B%0A        %09%09return -1;%0A        %09%7D else if(v1 %3E v2) %7B%0A        %09%09return 1;%0A        %09%7D%0A        %7D%0A        return 0;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A    %09System.out.println(compareVersion(%220.1%22, %220.1.1%22));%0A    %09System.out.println(compareVersion(%220.1%22, %220.1.0%22));%0A    %09System.out.println(compareVersion(%220.1%22, %220.0.1%22));%0A    %09System.out.println(compareVersion(%220.1%22, %221.0%22));%0A    %09System.out.println(compareVersion(%220.1%22, %221.1%22));%0A    %09System.out.println(compareVersion(%221.1%22, %220.1%22));%0A    %09System.out.println(compareVersion(%221.1%22, %221.1%22));%0A    %09System.out.println(compareVersion(%221.1%22, %221.2%22));%0A    %09System.out.println(compareVersion(%2201%22, %221%22));%0A    %7D%0A%7D

add Compare Version Numbers solution