Warshall’s Algorithm in Java