1Context context = Context.newBuilder("js").build();
2Value result = context.eval("js", "var list=[1,2,'foo',true]; list;");
3if (result.hasArrayElements()) {
4 for (int i=0;i<result.getArraySize();i++) {
5 System.out.println(result.getArrayElement(i));
6 }
7}