code: public static String base64FromBinary(byte[] value, int offset, int length) throws IllegalArgumentException {
          return DatatypeConverter.printBase64Binary(Arrays.copyOfRange(value, offset, offset + length));
      }
docs: Convert (encode) the given binary value, beginning at the given offset and
  consisting of the given length, using Base64.
  
  @param  value                    A binary value.
  @param  offset                   Zero-based index where data begins.
  @param  length                   Number of bytes to encode.
  @return                          Base64-encoded value.
  @throws IllegalArgumentException If the given value is null.