Floyd-Warshall shortest path implementation in java