vendredi 27 mars 2015

Convert C Unsigned char array to Java byte array and vice versa



I have an application with both Java and native code. The native part expects something like:

uint8_t data = {0xdb, 0x31, 0xc8, 0x58, 0x7b, 0x61, 0x93, 0xd2}; If I know this array at the Java layer, how do I initialize this as a byte array in Java so that it will get converted into this format in the native layer?


I get a "cannot convert from int to byte" error if I do byte bytes = new byte[] {0xdb, 0x31, 0xc8, 0x58, 0x7b, 0x61, 0x93, 0xd2}; Thank you very much for your kind help.




Aucun commentaire:

Enregistrer un commentaire