✅ ⟣ Java Solution ⟢
Code
# Code
```java []
class Solution {
    public int[][] highestPeak(int[][] isWater) {
        Queue<int[]> q = new LinkedList<>();
        int r = isWater.length, c = isWater[0].length;
        int ans[][] = new int[r][c];
        for(int i=0; i<r; i++) {
            for(int j=0; j<c; j++) {
                if(isWater[i][j] == 1) {
                    ans[i][j] = 0;
                    q.add(new int[]{i,j,0});
                } else ans[i][j] = -1;
            }
        }

        int[][] dirs = {{-1,0}, {1,0}, {0,1}, {0,-1}};
        while(!q.isEmpty()) {
            int[] top = q.remove();
            for(int dir[] : dirs) {
                int nr = top[0]+dir[0], nc = top[1]+dir[1];
                if(nr<0 || nc<0 || nr==r || nc==c || ans[nr][nc]!=-1) continue;
                ans[nr][nc] = top[2]+1;
                q.add(new int[]{nr,nc,top[2]+1});
            }
        }

        return ans;
    }
}
```
['Java']