title: converting String to ASCII--> BASE64
body: <p>I'm writing a REST client from a C# usage example. Now i need to convert a string in the proper format but can't find the equivalent method on Java.</p>
  
  <p>original:</p>
  
  <pre><code>string Credentials = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(string);
  </code></pre>
  
  <p>At this point I've done this:</p>
  
  <pre><code>String Credentials = new String(DatatypeConverter.parseBase64Binary(String)); 
  </code></pre>
  
  <p>but i still need the ASCII conversion and I'm not sure that the things I've fount will work fine, like: <a href="https://stackoverflow.com/questions/16458564/convert-string-to-ascii-value-in-java">Convert character to ASCII numeric value in java</a></p>
  
  <p>any clues?</p>
  
  <p>Thank you.</p>