code: public String getBinaryDataForXml(byte[] buffer) {        
          StringBuffer hexData = new StringBuffer();
          Base64Encoder encoder = new Base64Encoder();
          return encoder.encode(buffer);
      }
docs: http://www.javaworld.com/javatips/jw-javatip117.html