CRC8, CRC16 and conversion to little endian (udp)

Just starting to code for the DJI Tello quadrocopter (see https://github.com/f41ardu/TelloProcessing/tree/master ), cause you can control Tello in an SDK mode sending commands.

But to make most out of this little gadget I need crc8, crc16 and conversion to little endian before sending low level code per udp connection. After some research I’m quite sure that I found and reuse CRC8 and CRC16 in a correct way. I’m still far away to send low level commands cause I’m still struggeling with conversion to Little endian either in Processing or Java code. So you will not now low level code in my simple sketche based library.
There are already phyton and GO libs available, but as a friend of Processing I think it might be a good idea to have a library (or starting with a sketch) available for Processing, too.

Any input or advice is much appreciated.

I guess I found a solution

import java.nio.*;
import java.util.Arrays;

ByteBuffer byteBuffer = ByteBuffer.allocate(4);
byteBuffer.order(ByteOrder.BIG_ENDIAN);
byteBuffer.putInt(60);
byte[] result = byteBuffer.array();
System.out.println(Arrays.toString(result));
byteBuffer.flip();

byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
byteBuffer.putInt(60);
System.out.println(Arrays.toString(result));

Result

[0, 0, 0, 60]
[60, 0, 0, 0]

@f42ter – Thank you for posting the solution to your problem!