question: static String base64encode ( byte [ ] bytes ) { StringBuilder builder = new StringBuilder ( ( ( bytes . length + 2 ) / 3 ) * 4 ) ; for ( int i = 0 ; i < bytes . length ; i += 3 ) { byte b0 = bytes [ i ] ; byte b1 = i < bytes . length - 1 ? bytes [ i + 1 ] : 0 ; byte b2 = i < bytes . length - 2 ? bytes [ i + 2 ] : 0 ; builder . append ( BASE64_CHARS [ ( b0 & 0xFF ) > > 2 ] ) ; builder . append ( BASE64_CHARS [ ( ( b0 & 0x03 ) << 4 ) | ( ( b1 & 0xF0 ) > > 4 ) ] ) ; builder . append ( i < bytes . length - 1 ? BASE64_CHARS [ ( ( b1 & 0x0F ) << 2 ) | ( ( b2 & 0xC0 ) > > 6 ) ] : "=" ) ; builder . append ( i < bytes . length - 2 ? BASE64_CHARS [ b2 & 0x3F ] : "=" ) ; } return builder . toString ( ) ; }
target:  Encode an array of bytes to a string using base64 encoding.