### Question:
Levenshtein implements Comparator { public static int compactDistance(String s1, String s2) { if (s1.length() == 0) return s2.length(); if (s2.length() == 0) return s1.length(); int maxdist = Math.min(s1.length(), s2.length()) / 2; int s1len = s1.length(); int[] column = new int[s1len + 1]; int ix2 = 0; char ch2 = s2.charAt(ix2); column[0] = 1; for (int ix1 = 1; ix1 <= s1len; ix1++) { int cost = s1.charAt(ix1 - 1) == ch2 ? 0 : 1; column[ix1] = Math.min(column[ix1 - 1], ix1 - 1) + cost; } int above = 0; for (ix2 = 1; ix2 < s2.length(); ix2++) { ch2 = s2.charAt(ix2); above = ix2 + 1; int smallest = s1len * 2; for (int ix1 = 1; ix1 <= s1len; ix1++) { int cost = s1.charAt(ix1 - 1) == ch2 ? 0 : 1; int value = Math.min(Math.min(above, column[ix1 - 1]), column[ix1]) + cost; column[ix1 - 1] = above; above = value; smallest = Math.min(smallest, value); } column[s1len] = above; if (smallest > maxdist) return smallest; } return above; }  double compare(String s1, String s2); boolean isTokenized(); static int distance(String s1, String s2); static int compactDistance(String s1, String s2);  }### Answer:
@Test public void testCEmpty() { assertEquals(0, Levenshtein.compactDistance("", "")); }
@Test public void testCEmpty1() { assertEquals(1, Levenshtein.compactDistance("", "1")); }
@Test public void testCEmpty2() { assertEquals(1, Levenshtein.compactDistance("1", "")); }
@Test public void testCKitten() { assertEquals(3, Levenshtein.compactDistance("kitten", "sitting")); assertEquals(3, Levenshtein.compactDistance("sitting", "kitten")); }
@Test public void testCDays() { assertEquals(3, Levenshtein.compactDistance("saturday", "sunday")); assertEquals(3, Levenshtein.compactDistance("sunday", "saturday")); }
@Test public void testCGambol() { assertEquals(2, Levenshtein.compactDistance("gambol", "gumbo")); assertEquals(2, Levenshtein.compactDistance("gumbo", "gambol")); }
@Test public void testCTotallyUnlike() { assertEquals(3, Levenshtein.compactDistance("abcd", "efgh")); }