### Question:
StringEditDistance { public static int levenshtein(String first, String second) { int i, j; int[][] A; A = new int[2][second.length() + 1]; A[0][0] = 0; for (j = 1; j <= second.length(); ++j) { A[0][j] = A[0][j - 1] + 1; } for (i = 1; i <= first.length(); ++i) { A[i % 2][0] = A[(i - 1) % 2][0] + 1; for (j = 1; j <= second.length(); ++j) { if (first.charAt(i - 1) == second.charAt(j - 1)) { A[i % 2][j] = A[(i - 1) % 2][j - 1]; } else { A[i % 2][j] = min(A[(i - 1) % 2][j] + 1, A[i % 2][j - 1] + 1, A[(i - 1) % 2][j - 1] + 1); } } } return A[first.length() % 2][second.length()]; }  static int indel(String first, String second); static int levenshtein(String first, String second); static int DL(String first, String second); static int distance(String first, String second, EditDistanceType type); static BiCounter<Character, EdOp> operations(String first, String second); static int[] alignment(String first, String second);  }### Answer:
@Test public void testLevenshteinDistance() { System.out.println("levenshteinDistance"); String first = "patata"; String second = "apta"; int expResult = 3; int result = StringEditDistance.levenshtein(first, second); assertEquals(expResult, result); first = "holanda"; second = "wordland"; result = StringEditDistance.levenshtein(first, second); assertEquals(4, result); first = StringNormalizer.reduceWS("Mi enhorabuena"); second = StringNormalizer.reduceWS("mi en hora buena"); result = StringEditDistance.levenshtein(first, second); assertEquals(3, result); }