Sure! Here's the same function written in Java:
```
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

public class DepthMapVisualizer {
public static void visualizeDepthMap(double[][] depthMap) throws IOException {
// create image
int width = depthMap[0].length;
int height = depthMap.length;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    // create color map
    double minDepth = Double.POSITIVE_INFINITY;
    double maxDepth = Double.NEGATIVE_INFINITY;
    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            double depth = depthMap[y][x];
            if (depth < minDepth) {
                minDepth = depth;
            }
            if (depth > maxDepth) {
                maxDepth = depth;
            }
        }
    }
    double depthRange = maxDepth - minDepth;
    Color[] colorMap = new Color[256];
    for (int i = 0; i < 256; i++) {
        double depth = minDepth + (i / 255.0) * depthRange;
        colorMap[i] = getColorForDepth(depth);
    }

    // fill image with colors
    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            double depth = depthMap[y][x];
            int colorIndex = (int) Math.round((depth - minDepth) / depthRange * 255);
            Color color = colorMap[colorIndex];
            image.setRGB(x, y, color.getRGB());
        }
    }

    // save image
    File output = new File("depth_map.png");
    ImageIO.write(image, "png", output);
}

private static Color getColorForDepth(double depth) {
    // define color scheme here
    // return color based on depth
    return Color.getHSBColor(0.5f, 1.0f, 1.0f);
}
}
```
The Java function works in a similar way to the Python function. It takes in a 2D double array representing the depth map, and creates an image to visualize it.

First, the function creates a BufferedImage with the same dimensions as the input array. It then determines the minimum and maximum depth values in the array, and creates a color map with 256 colors. The getColorForDepth() method is used to determine the color for each depth value.

The function then fills the image with colors based on the depth values in the input array. Finally, the image is saved to a file using the ImageIO.write() method.

Note that in this Java implementation, we are saving the image to a file instead of showing it in a GUI window like we did with the Python implementation. If you want to display the image in a GUI window, you can use Java's Swing or JavaFX libraries to create a JFrame or Stage and display the image in an image view.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence