To pass argument to gradle run task main class. Add the below task to build.gradle

// For gradle run
task run (type: JavaExec, dependsOn: classes){
  if(project.hasProperty('arg')){
    args(arg.split(','))
  }
  main = "com.example.AddTwoNumber"
  classpath = sourceSets.main.runtimeClasspath
  jvmArgs = [
    "-Dkey=value"
  ]
  systemProperties System.getProperties()
}

And invoke like:

gradle run -Pargs=10,5