[Java] Easy Floyd Warshall algorithm solution
java\nclass Solution {\n    public int[] countOfPairs(final int n, final int x, final int y) {\n        final int[][] distances = new int[n][n];\n\n        for(
```java\nclass Solution {\n    public int[] countOfPairs(final int n, final int x, final int y) {\n        final int[][] distances = new int[n][n];\n\n        for(final int[] d : distances)\n            Arrays.fill(d, 100);\n\n        for(int i = 0; i < n - 1; ++i) {\n            distances[i][i + 1] = 1;\n            distances[i + 1][i] = 1;\n        }\n\n        distances[x - 1][y - 1] = 1;\n        distances[y - 1][x - 1] = 1;\n\n        for(int i = 0; i < n; ++i)\n            for(int j = 0; j < n; ++j)\n                for(int k = 0; k < n; ++k)\n                    distances[j][k] = Math.min(distances[j][k], distances[j][i] + distances[i][k]);\n\n        final int[] total = new int[n];\n\n        for(int i = 0; i < n; ++i)\n            for(int j = 0; j < n; ++j)\n                if(i != j)\n                    total[distances[i][j] - 1]++;\n\n        return total;\n    }\n}\n```
['Java']