code: public static String base64Encode(String plainTextString) {
          String encoded = new String(Base64.getEncoder().encode(plainTextString.getBytes()));
          return encoded;
      }
docs: Encodes a string using Base64 encoding.
  
  @param plainTextString the string to encode
  @return the given string as a Base64 encoded string.