Creating and Passing Arrays of Primitive Types

To create Java arrays, use the op-code CJAVA-CREATEARRAY and pass in the type of the array and the size of the array. Return the array handle through the GIVING statement.

In the example below, an array of ints is created, and ARRAY-SIZE is declared USAGE IS SIGNED-INT VALUE 10. An object method that would take this array would have a parameter in its signature of type [I such as "([I)I". The primitives array types are documented in the topic Method Signatures.

CALL "C$JAVA" USING CJAVA-CREATEARRAY, CJAVA-INTARRAY, ARRAY-SIZE GIVING ARRAY-HANDLE.