public static int levenshtein(String a, String b) {
        // switch parameters to use the shorter one as b to save space.
        if (a.length() < b.length()) {
            String swap = a;
            a = b;
            b = swap;
        }

        int[][] d = new int[2][b.length() + 1];

        for (int j = 0; j <= b.length(); j++) {
            d[0][j] = j;
        }

        for (int i = 1; i <= a.length(); i++) {
            d[1][0] = i;

            for (int j = 1; j <= b.length(); j++) {
                int cost = a.charAt(i - 1) == b.charAt(j - 1) ? 0 : 1;
                d[1][j] = MathEx.min(
                        d[0][j] + 1, // deletion
                        d[1][j - 1] + 1, // insertion
                        d[0][j - 1] + cost); // substitution
            }
            int[] swap = d[0];
            d[0] = d[1];
            d[1] = swap;
        }

        return d[0][b.length()];
    }
@Test
    public void testPlainLevenshteinSpeedTest() {
        System.out.println("Levenshtein speed test");
        for (int i = 0; i < 100; i++) {
            EditDistance.levenshtein(H1N1, H1N5);
        }
    }