question: public Image convertToArdor3DImage ( ByteBuffer raster , int pixelSize , ImageDataFormat format , DataType dataType , int width , int height ) { ByteBuffer byteBuffer = null ; PixelDataType type = PixelDataType . Byte ; switch ( dataType ) { case Integer : case UnsignedInteger : if ( format == null ) { format = ImageDataFormat . RGBA ; } type = PixelDataType . UnsignedByte ; break ; case Float : format = ImageDataFormat . Luminance ; type = PixelDataType . Float ; break ; case Short : case UnsignedShort : format = ImageDataFormat . Luminance ; type = PixelDataType . UnsignedShort ; break ; case Byte : case UnsignedByte : if ( format == null ) { if ( pixelSize == 24 ) { format = ImageDataFormat . RGB ; } else if ( pixelSize == 32 ) { format = ImageDataFormat . RGBA ; } else if ( pixelSize == 16 ) { format = ImageDataFormat . LuminanceAlpha ; } else { format = ImageDataFormat . Luminance ; } } type = PixelDataType . UnsignedByte ; break ; case Double : case Long : case Unknown : return ( null ) ; } byteBuffer = BufferUtils . createByteBuffer ( raster . limit ( ) ) ; byteBuffer . put ( raster ) ; byteBuffer . rewind ( ) ; Image theImage = null ; ArrayList < ByteBuffer > list = new ArrayList < ByteBuffer > ( 1 ) ; list . add ( byteBuffer ) ; theImage = new Image ( format , type , width , height , list , null ) ; return ( theImage ) ; }
target:  Convert a ByteBuffer to an Ardor3D Image