Available in the LEADTOOLS Imaging toolkit.
Grayscale example for Visual J++
This example converts the bitmap to 12-bit grayscale.
LEAD1.Grayscale( (short) 12 ); //Grayscale image to 12-bit