code: public static char[] encode(final byte[] input, final int iOff, final int iLen) {
         final int oDataLen = (iLen * CONSTANT_4 + 2) / CONSTANT_3; // output length without padding
         final int oLen = ((iLen + 2) / CONSTANT_3) * CONSTANT_4; // output length including padding
         char[] out = new char[oLen];
         int ipValue = iOff;
         final int iEnd = iOff + iLen;
         int opValue = 0;
         while (ipValue < iEnd) {
             final int i0Value = input[ipValue++] & CONSTANT_0XFF;
             final int i1Value = ipValue < iEnd ? input[ipValue++] & CONSTANT_0XFF : 0;
             final int i2Value = ipValue < iEnd ? input[ipValue++] & CONSTANT_0XFF : 0;
             final int o0Value = i0Value >>> 2;
             final int o1Value = ((i0Value & CONSTANT_3) << CONSTANT_4) | (i1Value >>> CONSTANT_4);
             final int o2Value = ((i1Value & CONSTANT_0XF) << 2) | (i2Value >>> CONSTANT_6);
             final int o3Value = i2Value & CONSTANT_0X3F;
             out[opValue++] = map1[o0Value];
             out[opValue++] = map1[o1Value];
             out[opValue] = opValue < oDataLen ? map1[o2Value] : '=';
             opValue++;
             out[opValue] = opValue < oDataLen ? map1[o3Value] : '=';
             opValue++;
         }
         return out;
     }
docs: Encode.
  
  @param input the input
  @param iOff the i off
  @param iLen the i len
  @return the char[]