title: Base64 String to byte[] in java
body: <p>I am trying to convert base64 String to byte array but it is throwing following error </p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: Illegal base64 character 3a</p>
  </blockquote>
  
  <p>I have tried following options userimage is base64 string  </p>
  
  <pre><code>byte[] img1 = org.apache.commons.codec.binary.Base64.decodeBase64(userimage);`
  
  /* byte[] decodedString = Base64.getDecoder().decode(encodedString.getBytes(UTF_8));*/
  /* byte[] byteimage =Base64.getDecoder().decode( userimage );*/
  /* byte[] byteimage =  Base64.getMimeDecoder().decode(userimage);*/`
  </code></pre>