private static int compare(String str1, String str2) {
		String[] s1 = str1.split("\\.");
		int l1 = s1.length;
		String[] s2 = str2.split("\\.");
		int l2 = s2.length;

		int i = 0;
		// skip equals parts
		while (i < l1 && i < l2) {
			if (!s1[i].equals(s2[i])) {
				break;
			}
			i++;
		}
		// compare first non-equal ordinal number
		if (i < l1 && i < l2) {
			return Integer.valueOf(s1[i]).compareTo(Integer.valueOf(s2[i]));
		}
		boolean checkFirst = l1 > l2;
		boolean zeroTail = isZeroTail(checkFirst ? s1 : s2, i);
		if (zeroTail) {
			return 0;
		}
		return checkFirst ? 1 : -1;
	}
@Test
	public void testCompare() {
		checkCompare("", "", 0);
		checkCompare("1", "1", 0);
		checkCompare("1", "2", -1);
		checkCompare("1.1", "1.1", 0);
		checkCompare("0.5", "0.5", 0);
		checkCompare("0.5", "0.5.0", 0);
		checkCompare("0.5", "0.5.00", 0);
		checkCompare("0.5", "0.5.0.0", 0);
		checkCompare("0.5", "0.5.0.1", -1);
		checkCompare("0.5.0", "0.5.0", 0);
		checkCompare("0.5.0", "0.5.1", -1);
		checkCompare("0.5", "0.5.1", -1);
		checkCompare("0.4.8", "0.5", -1);
		checkCompare("0.4.8", "0.5.0", -1);
		checkCompare("0.4.8", "0.6", -1);
		checkCompare("1.3.3.1", "1.3.3", 1);
		checkCompare("1.3.3-1", "1.3.3", 1);
		checkCompare("1.3.3.1-1", "1.3.3", 1);
	}