### Question:
VersionUtils { @SuppressWarnings("CallToStringCompareTo") public static int compareVersionNumbers(final CharSequence version1, final CharSequence version2) { if (version1 == null && version2 == null) { return 0; } else if (version1 == null) { return -1; } else if (version2 == null) { return 1; } String[] part1 = VERSION_PATTERN.split(version1); String[] part2 = VERSION_PATTERN.split(version2); int idx = 0; for (; idx < part1.length && idx < part2.length; idx++) { String p1 = part1[idx]; String p2 = part2[idx]; int cmp; if (VERSION_NUMBER_PATTERN.matcher(p1).matches() && VERSION_NUMBER_PATTERN.matcher(p2).matches()) { cmp = Integer.valueOf(p1).compareTo(Integer.valueOf(p2)); } else { cmp = part1[idx].compareTo(part2[idx]); } if (cmp != 0) { return cmp; } } if (part1.length == part2.length) { return 0; } else if (part1.length > idx) { return 1; } else { return -1; } } private  VersionUtils(); static boolean isHigherOrSame(final CharSequence version1, final CharSequence version2); @SuppressWarnings("CallToStringCompareTo") static int compareVersionNumbers(final CharSequence version1, final CharSequence version2);  }### Answer:
@Test public void testCompareVersionNumbers() throws Exception { int result = VersionUtils.compareVersionNumbers("1.02.01", "1.02.00"); assertEquals(1, result); result = VersionUtils.compareVersionNumbers("1.02.00", "1.02.00"); assertEquals(0, result); result = VersionUtils.compareVersionNumbers("1.02.00", "1.02.01"); assertEquals(-1, result); result = VersionUtils.compareVersionNumbers("1.02.01-SNAPSHOT", "1.02.00"); assertEquals(1, result); final boolean higherOrSame = VersionUtils.isHigherOrSame("1.02.01-SNAPSHOT", "1.02.00"); assertTrue(higherOrSame); result = VersionUtils.compareVersionNumbers("1.02.00-SNAPSHOT", "1.02.00-SNAPSHOT"); assertEquals(0, result); result = VersionUtils.compareVersionNumbers("1.02.00", "1.02.01-SNAPSHOT"); assertEquals(-1, result); result = VersionUtils.compareVersionNumbers(null, null); assertEquals(0, result); result = VersionUtils.compareVersionNumbers("1.00.00", null); assertEquals(1, result); result = VersionUtils.compareVersionNumbers(null, "1.00.00"); assertEquals(-1, result); }