Java example array job

public class Java_Array_Job { public static void main(String[] args) { String res = System.getenv("SLURM_ARRAY_TASK_ID"); int task_id = Integer.parseInt(res); Integer nsamples = 10 * (int) Math.pow(2, task_id); System.out.println("I am array job #" + res + "  and generated the number 10 * pow(2, $SLURM_ARRAY_TASK_ID ) =  " + Integer.toString(nsamples)); } }

Cut and paste the above code into a file named Java_Array_Job.java, and compile it with the following command:

javac Java_Array_Job.java