public static String base64EncodeByteArray(byte[] bytes){
  try {
    byte[] encodeBase64=Base64.encodeBase64(bytes);
    return new String(encodeBase64,"UTF-8");
  }
 catch (  Exception e) {
    throw new RuntimeException("Exception while encoding bytes: " + Arrays.toString(bytes));
  }
}

public static String base64EncodeByteArray ( byte [ ] bytes ) { try { byte [ ] encodeBase64 = Base64 . encodeBase64 ( bytes ) ; return new String ( encodeBase64 , "UTF-8" ) ; } catch ( Exception e ) { throw new RuntimeException ( "Exception while encoding bytes: " + Arrays . toString ( bytes ) ) ; } }
base64 encode a byte array using org . apache . commons . codec . binary . base64
