How to convert depth frame to grey image?

MultiSensorViewer example on Linux showing the depth image as this:

And on android device the depth image show as this:

How can i show the depth image on Android in the same way as on Linux?
In MultiSensorViewer they are using ‘LitDepthVisualizer’ class to convert depth data, is any one tried to convert this class to Java?

I believe the Linux version is only using the lower 8 bits from the raw 16-bit depth data, while the Android version is using treating the data as full 16-bit grayscale.

To get Android to show the image so it appears as it does in Linux, covert the short[] data into byte[] data, keeping only the lower 8 bits.

Conversely, to show the Android-style image on Linux you’d need to create a 16-bit grayscale image using the raw depth data from the camera.