int (String version1, String version2) { final List<String> vs1 = parse(version1); final List<String> vs2 = parse(version2); for (int i = 0; i < vs1.size() && i < vs2.size(); i++) { final String vs1Part = vs1.get(i); final String vs2Part = vs2.get(i); if (vs1Part.equals("**") || vs2Part.equals("**")) { return 0; } final int result = vs1Part.compareTo(vs2Part); if (result != 0) { return result; } } return vs1.size() - vs2.size(); }