private static String encodeBase64(final byte[] buffer) {
        final int l = buffer.length;
        final char[] out = new char[l << 1];
        int j = 0;
        for (int i = 0; i < l; i++) {
            out[j++] = DIGITS[(0xF0 & buffer[i]) >>> 4];
            out[j++] = DIGITS[0x0F & buffer[i]];
        }
        return String.copyValueOf(out);
    }
private static String encodeBase64 ( final byte [ ] buffer ) { final int l = buffer . length ; final char [ ] out = new char [ l << 1 ] ; int j = 0 ; for ( int i = 0 ; i < l ; i ++ ) { out [ j ++ ] = DIGITS [ ( 0xF0 & buffer [ i ] ) > > > 4 ] ; out [ j ++ ] = DIGITS [ 0x0F & buffer [ i ] ] ; } return String . copyValueOf ( out ) ; }
Encodes a byte array base64.

@param buffer
Bytes to encode.

@return Base64 encoded string.