Hello,

I understand that the proper way to create a Java byte array in Rhino
is by using the following code (which creates an empty byte array with
four indexes):

var my_byte_array = new
Packages.java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 4);

If I wanted to store the integer 1024 in the array what would be the
preferred method?

I can do something like the following, but I assume there is something
similar to byte[1024] that I can use, which would be easier.

buffer[0] = 4;
buffer[1] = 2;
buffer[2] = 0;
buffer[3] = 1;

Thanks
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to