@SuppressWarnings("StatementWithEmptyBody")
    public static String encode(byte[] input) {
        ByteArrayInputStream in = new ByteArrayInputStream(input);
        StringBuilder sb = new StringBuilder();
        try {
            while (encode(sb, in)) {
                // do nothing
            }
        } catch (IOException ex) {
            Logger.getLogger(Base64.class.getName()).log(Level.SEVERE, null, ex);
        }


        return sb.toString();
    }
@ SuppressWarnings ( "StatementWithEmptyBody" ) public static String encode ( byte [ ] input ) { ByteArrayInputStream in = new ByteArrayInputStream ( input ) ; StringBuilder sb = new StringBuilder ( ) ; try { while ( encode ( sb , in ) ) { } } catch ( IOException ex ) { Logger . getLogger ( Base64 . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ; } return sb . toString ( ) ; }
Base64 encode a textual string according to RFC 3548

@param input The bytes to encode
@return The encoded string