title: Base64 difference between C# and Java
body: <p><code>image</code> is the string of an image file .</p>
  
  <p>I have code as follows in C#:</p>
  
  <p><code>Convert.ToBase64String(image);</code></p>
  
  <p>and code as follows in Java:
  <code>org.apache.commons.codec.binary.Base64.encodeBase64(image.getBytes())</code></p>
  
  <p>The result is different.</p>
  
  <p>Somebody says its because </p>
  
  <ul>
  <li><p>Java byte : -128 to 127</p></li>
  <li><p>C#   byte : 0 to 255</p></li>
  </ul>
  
  <p>But how can I fix this? How can I implement C#'s <code>Convert.ToBase64String()</code> in Java?
  I need the same result as in C# by using Java.</p>