question: public byte [ ] toByteArray ( ) { try { ByteArrayOutputStream array = new ByteArrayOutputStream ( ) ; DataOutputStream out = new DataOutputStream ( array ) ; out . writeShort ( width ) ; out . writeShort ( height ) ; out . writeByte ( palette . length ) ; int plen = palette . length ; for ( int iter = 0 ; iter < plen ; iter ++ ) { out . writeInt ( palette [ iter ] ) ; } out . write ( imageDataByte ) ; out . close ( ) ; return array . toByteArray ( ) ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; return null ; } }
target:  This method allows us to store a package image into a persistent stream easily thus allowing us to store the image in RMS.