question: public static String encode ( byte [ ] bytes ) { int len = bytes . length ; final StringBuffer encoded = new StringBuffer ( ( len + 2 ) / 3 * 4 ) ; int i = 0 ; int j = len ; while ( j >= 3 ) { encoded . append ( to64 ( ( ( ( bytes [ i ] & 0xff ) << 16 ) | ( int ) ( ( bytes [ i + 1 ] & 0xff ) << 8 ) | ( int ) ( bytes [ i + 2 ] & 0xff ) ) , 4 ) ) ; i += 3 ; j -= 3 ; } if ( j == 2 ) { encoded . append ( to64 ( ( ( bytes [ i ] & 0xff ) << 8 ) | ( ( bytes [ i + 1 ] & 0xff ) ) , 3 ) ) ; } if ( j == 1 ) { encoded . append ( to64 ( ( ( bytes [ i ] & 0xff ) ) , 2 ) ) ; } return encoded . toString ( ) ; }
target:  Encodes an array of byte into a string of printable ASCII characters using a base-64 encoding.