code: public static String encode(byte[] bytes, String indentation) {
          int length = bytes.length;
          if (length == 0) return "";  // empty byte array
          String encoded = Base64.encodeBase64String(bytes).replaceAll("\\s", "");  // remove all white space
          StringBuilder result = new StringBuilder();
          if (indentation != null) result.append(indentation);
          result.append(encoded.charAt(0));
          for (int c = 1; c < encoded.length(); c++) {
              if (c % 80 == 0) {
                  // format to indented 80 character blocks
                  result.append("\n");
                  if (indentation != null) result.append(indentation);
              }
              result.append(encoded.charAt(c));
          }
          return result.toString();
      }
docs: This function encodes a byte array using base 64 with a specific indentation of new lines.
  
  @param bytes The byte array to be encoded.
  @param indentation The indentation string to be inserted before each new line.
  @return The base 64 encoded string.