### Question:
CSN implements Serializable, Comparable<CSN> { public static int diffSeqNum(CSN csn1, CSN csn2) { if (csn1 == null) { return 0; } if (csn2 == null) { return csn1.getSeqnum(); } if (csn2.isNewerThanOrEqualTo(csn1)) { return 0; } int seqnum1 = csn1.getSeqnum(); long time1 = csn1.getTime(); int seqnum2 = csn2.getSeqnum(); long time2 = csn2.getTime(); if (time2 <= time1) { if (seqnum2 <= seqnum1) { return seqnum1 - seqnum2; } return Integer.MAX_VALUE - (seqnum2 - seqnum1) + 1; } return 0; } CSN(String str);  CSN(long timeStamp, int seqNum, int serverId); static CSN valueOf(String s); static CSN valueOf(ByteSequence bs); long getTime(); long getTimeSec(); int getSeqnum(); int getServerId(); @Override boolean equals(Object obj); @Override int hashCode(); ByteString toByteString(); void toByteString(ByteStringBuilder builder); @Override String toString(); String toStringUI(); static int compare(CSN csn1, CSN csn2); static int diffSeqNum(CSN csn1, CSN csn2); boolean isOlderThan(CSN csn); boolean isOlderThanOrEqualTo(CSN csn); boolean isNewerThanOrEqualTo(CSN csn); boolean isNewerThan(CSN csn); @Override int compareTo(CSN csn); static final int BYTE_ENCODING_LENGTH; static final int STRING_ENCODING_LENGTH; static final CSN MAX_CSN_VALUE; }### Answer:
@Test public void csnDiffSeqNum() throws Exception { CSN csn1; CSN csn2; csn1 = new CSN(0, 3, 0); csn2 = new CSN(0, 0, 0); assertEquals(CSN.diffSeqNum(csn1, csn2), 3); csn2 = new CSN(0, 1, 0); assertEquals(CSN.diffSeqNum(csn1, csn2), 2); csn2 = new CSN(0, 3, 0); assertEquals(CSN.diffSeqNum(csn1, csn2), 0); csn2 = new CSN(0, 4, 0); assertEquals(CSN.diffSeqNum(csn1, csn2), 0); csn1 = new CSN(0, 0, 0); csn2 = new CSN(0, 0, 0); assertEquals(CSN.diffSeqNum(csn1, csn2), 0); csn2 = new CSN(0, 1, 0); assertEquals(CSN.diffSeqNum(csn1, csn2), 0); csn1 = new CSN(0, 5, 0); csn2 = new CSN(0, 2, 0); assertEquals(CSN.diffSeqNum(csn1, null), 5); assertEquals(CSN.diffSeqNum(null, csn2), 0); assertEquals(CSN.diffSeqNum(null, null), 0); csn1 = new CSN(1111111, 2, 0); csn2 = new CSN(3333333, 4, 0); assertEquals(CSN.diffSeqNum(csn1, csn2), 0); csn1 = new CSN(3333333, 1, 0); csn2 = new CSN(1111111, Integer.MAX_VALUE-1, 0); assertEquals(CSN.diffSeqNum(csn1, csn2), 3); }