### Question:
Levenshtein implements Comparator { public static int distance(String s1, String s2) { if (s1.length() == 0) return s2.length(); if (s2.length() == 0) return s1.length(); int s1len = s1.length(); int[] matrix = new int[(s1len + 1) * (s2.length() + 1)]; for (int col = 0; col <= s2.length(); col++) matrix[col * s1len] = col; for (int row = 0; row <= s1len; row++) matrix[row] = row; for (int ix1 = 0; ix1 < s1len; ix1++) { char ch1 = s1.charAt(ix1); for (int ix2 = 0; ix2 < s2.length(); ix2++) { int cost; if (ch1 == s2.charAt(ix2)) cost = 0; else cost = 1; int left = matrix[ix1 + ((ix2 + 1) * s1len)] + 1; int above = matrix[ix1 + 1 + (ix2 * s1len)] + 1; int aboveleft = matrix[ix1 + (ix2 * s1len)] + cost; matrix[ix1 + 1 + ((ix2 + 1) * s1len)] = Math.min(left, Math.min(above, aboveleft)); } } return matrix[s1len + (s2.length() * s1len)]; }  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 testEmpty() { assertEquals(0, Levenshtein.distance("", "")); }
@Test public void testEmpty1() { assertEquals(1, Levenshtein.distance("", "1")); }
@Test public void testEmpty2() { assertEquals(1, Levenshtein.distance("1", "")); }
@Test public void testKitten() { assertEquals(3, Levenshtein.distance("kitten", "sitting")); assertEquals(3, Levenshtein.distance("sitting", "kitten")); }
@Test public void testDays() { assertEquals(3, Levenshtein.distance("saturday", "sunday")); assertEquals(3, Levenshtein.distance("sunday", "saturday")); }
@Test public void testGambol() { assertEquals(2, Levenshtein.distance("gambol", "gumbo")); assertEquals(2, Levenshtein.distance("gumbo", "gambol")); }
@Test public void testTotallyUnlike() { assertEquals(4, Levenshtein.distance("abcd", "efgh")); }