code: private static String encodeBase64(final byte[] buffer) {
          final int l = buffer.length;
          final char[] out = new char[l << 1];
          int j = 0;
          for (int i = 0; i < l; i++) {
              out[j++] = DIGITS[(0xF0 & buffer[i]) >>> 4];
              out[j++] = DIGITS[0x0F & buffer[i]];
          }
          return String.copyValueOf(out);
      }
docs: Encodes a byte array base64.
  
  @param buffer
  Bytes to encode.
  
  @return Base64 encoded string.