title: Apache commons base64 decode and Sun base64 decode
body: <pre><code>byte[] commonsDecode = Base64.decodeBase64(data);
  debug("The data is " + commonsDecode.length + " bytes long for the apache commons base64 decoder.");
  BASE64Decoder decoder = new BASE64Decoder();
  byte[] sunDecode = decoder.decodeBuffer(data);
  Log.debug("The data is " + sunDecode.length + " bytes long for the SUN base64 decoder.");
  </code></pre>
  
  <p>Please explain to me why these two method calls would produce different length for the resulting byte arrays. I initially thought it might have to do with character encodings but if so I don't understand all of the issues properly. The above code was executed on the same system and in the same application, in the order shown above. So the default character encoding on that system would be the same.</p>
  
  <p><strong>The input (test) data:</strong>
  The below is a System.out.println of the Java String.</p>
  
  <pre><code>qFkIQgDq jk3ScHpqx8BPVS97YE4pP/nBl5Qw7mBnpSGqNqSdGIkLPVod0pBl Uz7NgpizHDicGzNCaauefAdwGklpPr0YdwCu4wRkwyAuvtDmL0BYASOn2tDw72LMz5FChtSa0CoCBQ2ARsFG2GdflnIWsUuBQapX73ZBMiqqm  ZCOnMRv9Ol8zT1TECddlKZMYAvmjANgq0sBPyUMF7co XY9BYAjV3L/cA8CGQpXGdrsAgjPKMhzk4hh1GAoQ1soX2Dva8p3erPJ4sy2Vcb6lS1Hap9FR0AZFawbJ10FFSTg10wxc24539kYA6xxq/TFqkhaEoSyTqjXjvo1SA==
  </code></pre>
  
  <p>Apache commons decoder says it's 252 length byte array.
  Java Sun decoder says 256.</p>