code: public static byte[] encode(byte[] bytes, boolean lineBreaks) {
      ByteArrayInputStream in = new ByteArrayInputStream(bytes);
      // calculate the length of the resulting output.
      // in general it will be 4/3 the size of the input
      // but the input length must be divisible by three.
      // If it isn't the next largest size that is divisible
      // by three is used.
      int mod;
      int length = bytes.length;
      if ((mod = length % 3) != 0) {
        length += 3 - mod;
      }
      length = length * 4 / 3;
      ByteArrayOutputStream out = new ByteArrayOutputStream(length);
      try {
        encode(in, out, lineBreaks);
      } catch (IOException x) {
        // This can't happen.
        // The input and output streams were constructed
        // on memory structures that don't actually use IO.
        throw new RuntimeException(x);
      }
      return out.toByteArray();
    }
docs: Encode bytes in Base64.
  
  @param bytes The data to encode.
  @param lineBreaks Whether to insert line breaks every 76 characters in the output.
  @return Encoded bytes.
  @since ostermillerutils 1.04.00