question: public void printBytes ( byte [ ] data , int offset , int length ) throws IOException { int i ; for ( ; length >= 3 ; length -= 3 ) { int chunk = ( ( ( data [ offset ] & 0xff ) << 16 ) + ( ( data [ offset + 1 ] & 0xff ) << 8 ) + ( data [ offset + 2 ] & 0xff ) ) ; os . write ( base64encode ( chunk > > 18 ) ) ; os . write ( base64encode ( chunk > > 12 ) ) ; os . write ( base64encode ( chunk > > 6 ) ) ; os . write ( base64encode ( chunk ) ) ; offset += 3 ; } if ( length == 2 ) { int chunk = ( ( data [ offset ] & 0xff ) << 8 ) + ( data [ offset + 1 ] & 0xff ) ; os . write ( base64encode ( chunk > > 12 ) ) ; os . write ( base64encode ( chunk > > 6 ) ) ; os . write ( base64encode ( chunk ) ) ; os . write ( '=' ) ; } else if ( length == 1 ) { int chunk = data [ offset ] & 0xff ; os . write ( base64encode ( chunk > > 6 ) ) ; os . write ( base64encode ( chunk ) ) ; os . write ( '=' ) ; os . write ( '=' ) ; } }
target:  Prints a byte array to the stream, properly encoded  in base64.