VersionInfo implements Comparable<VersionInfo> { @Override public int compareTo(VersionInfo o) { for (int i = 0; i < Math.max(versionParts.length, o.versionParts.length); i++) { int v1 = i < versionParts.length ? versionParts[i] : 0; int v2 = i < o.versionParts.length ? o.versionParts[i] : 0; if (v1 != v2) { return v1 - v2; } } return 0; } VersionInfo();  VersionInfo(String name); String getName(); void setName(String name); String getInfo(); void setInfo(String info); boolean isFeatures(); void setFeatures(boolean features); boolean isBugfixes(); void setBugfixes(boolean bugfixes); boolean isSecurity(); void setSecurity(boolean security); int[] getVersionParts(); @Override int compareTo(VersionInfo o);  }
@Test public void testComparison() { Assert.assertTrue(new VersionInfo("1.2.3").compareTo(new VersionInfo("0.5")) > 0); Assert.assertTrue(new VersionInfo("1.2.3").compareTo(new VersionInfo("1.2.3.0")) == 0); Assert.assertTrue(new VersionInfo("0.2.3").compareTo(new VersionInfo("1.2.3.0")) < 0); }