Here you can find the source of versionCompare(String str1, String str2)
public static int versionCompare(String str1, String str2)
//package com.java2s; //License from project: Open Source License public class Main { public static int versionCompare(String str1, String str2) { String[] vals1 = str1.split("\\."); String[] vals2 = str2.split("\\."); int i = 0; while (i < vals1.length && i < vals2.length && vals1[i].equals(vals2[i])) { i++;// w ww.j a v a 2s . c om } if (i < vals1.length && i < vals2.length) { int diff = Integer.valueOf(vals1[i]).compareTo( Integer.valueOf(vals2[i])); return Integer.signum(diff); } return Integer.signum(vals1.length - vals2.length); } }