code: public static byte[] toByteArray(String string, ProcessEngine processEngine) {
      ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration();
      Charset charset = processEngineConfiguration.getDefaultCharset();
      return string.getBytes(charset);
    }
docs: Gets the bytes from a string using the provided process engine's default charset
  
  @param string the string to get the bytes form
  @param processEngine the process engine to use
  @return the byte array