Wagner-Fischer algorithm Please let me know if there is any other optimal way of doing this.

public class StringDistance {

public static void main(String[] args) {
    int i, j, m, n, temp, tracker;

    int[][] d = new int[100][100];

    String s = "kittenede";
    String t = "sitting";

    char u[] = s.toCharArray();
    char v[] = t.toCharArray();

    m = u.length;
    n = v.length;

    for (i = 0; i &lt;= m; i++) {
        d[i][0] = i;
    }
    for (j = 0; j &lt;= n; j++) {
        d[0][j] = j;
    }

    for (j = 1; j &lt;= m; j++) {
        for (i = 1; i &lt;= n; i++) {
            if (u[j - 1] == v[i - 1]) {
                tracker = 0;
            } else {
                tracker = 1;
            }
            temp = Math.min((d[i - 1][j] + 1), (d[i][j - 1] + 1));
            d[i][j] = Math.min(temp, (d[i - 1][j - 1] + tracker));

        }
    }

    System.out.println("The levenstien distance" + " " + d[n][m]);
}
}
Bug
Your program computes the distance between &quot;kittenede&quot; and &quot;s&quot; as 1.  For some reason you switched your two array indices when you initialized them:

for (i = 0; i &lt;= m; i++) {
    d[i][0] = i;
}
for (j = 0; j &lt;= n; j++) {
    d[0][j] = j;
}


should be:
for (i = 0; i &lt;= m; i++) {
    d[0][i] = i;
}
for (j = 0; j &lt;= n; j++) {
    d[j][0] = j;
}

With this change, the program correctly computes the distance between &quot;kittenede&quot; and &quot;s&quot; as 9.
Fixed length array
There's no need for this:
int[][] d = new int[100][100];

when you already know the lengths of your two strings.  You should just move that line lower and use the n and m you compute:
int[][] d = new int[n+1][m+1];