This is the compareTo method in the Organization class public int compareTo(Organization o) { // TODO Horky: this is bad....i think if (StringUtils.isNumeric(this.getAbbreviation().substring(0, 1))) { if (StringUtils.isNumeric(o.getAbbreviation().substring(0, 1))) { // strip the numbers off of this organization int thisPrefix = 0; String thisSuffix = ""; for (int i=2; i < this.abbreviation.length(); i++) { if (!StringUtils.isNumeric(this.abbreviation.substring(0, i))) { thisPrefix = Integer.parseInt(this.abbreviation.substring(0, i-1)); thisSuffix = this.abbreviation.substring(i-1, this.abbreviation.length()).trim(); break; } } // strip the numbers off of the passed in organization int thatPrefix = 0; String thatSuffix = ""; for (int i=2; i < o.getAbbreviation().length(); i++) { if (!StringUtils.isNumeric(o.getAbbreviation().substring(0, i))) { thatPrefix = Integer.parseInt(o.getAbbreviation().substring(0, i-1)); thatSuffix = o.getAbbreviation().substring(i-1, o.getAbbreviation().length()).trim(); break; } } // if they both have the same organization number prefix, compare the actual abbreviated name if (thisPrefix == thatPrefix) { return thisSuffix.compareTo(thatSuffix); } if (thisPrefix > thatPrefix) { return 1; } if (thisPrefix < thatPrefix) { return -1; } } else { return -1; } } else { if (StringUtils.isNumeric(o.getAbbreviation().substring(0, 1))) { return -1; } else { return this.getAbbreviation().compareTo(o.getAbbreviation()); } } return 0; }