Module jballerina.java.arrays
![](https://bcentral-packageicons.azureedge.net/images/ballerina_jballerina.java.arrays_1.3.0.png)
ballerina/jballerina.java.arrays Ballerina library
1.3.0
Overview
This module provides APIs to create new Java array instances, get elements from arrays, set elements, etc.
Create a Java array instance
handle stringClass = check java:getClass("java.lang.String"); handle StrArray = arrays:newInstance(stringClass, 4);
Get an element from a Java array
handle firstWord = arrays:get(words, 0);
Replace an element in a Java array
arrays:set(strArray, 0, java:fromString("Ballerina"));
Get Java array length
int length = arrays:getLength(array);
Get a Ballerina array from a Java array
int[] array = <int[]> check arrays:fromHandle(arrayHandle, "int");
Get a Java array from a Ballerina array
handle handleValue = check arrays:toHandle(bArray, "char");