question: public String encode ( byte [ ] input , boolean addQuotes ) { int inputEnd = input . length ; StringBuilder sb ; { int outputLen = inputEnd + ( inputEnd > > 2 ) + ( inputEnd > > 3 ) ; sb = new StringBuilder ( outputLen ) ; } if ( addQuotes ) { sb . append ( '"' ) ; } int chunksBeforeLF = getMaxLineLength ( ) > > 2 ; int inputPtr = 0 ; int safeInputEnd = inputEnd - 3 ; while ( inputPtr <= safeInputEnd ) { int b24 = ( ( int ) input [ inputPtr ++ ] ) << 8 ; b24 |= ( ( int ) input [ inputPtr ++ ] ) & 0xFF ; b24 = ( b24 << 8 ) | ( ( ( int ) input [ inputPtr ++ ] ) & 0xFF ) ; encodeBase64Chunk ( sb , b24 ) ; if ( -- chunksBeforeLF <= 0 ) { sb . append ( '\\' ) ; sb . append ( 'n' ) ; chunksBeforeLF = getMaxLineLength ( ) > > 2 ; } } int inputLeft = inputEnd - inputPtr ; if ( inputLeft > 0 ) { int b24 = ( ( int ) input [ inputPtr ++ ] ) << 16 ; if ( inputLeft == 2 ) { b24 |= ( ( ( int ) input [ inputPtr ++ ] ) & 0xFF ) << 8 ; } encodeBase64Partial ( sb , b24 , inputLeft ) ; } if ( addQuotes ) { sb . append ( '"' ) ; } return sb . toString ( ) ; }
target:  Convenience method for converting given byte array as base64 encoded String using this variant's settings, optionally enclosed in double-quotes.