I've started learning a little java, and am trying to accomplish what is likely a very simply task but I'm struggling with it.
Say I have a byte array:
byte[] test = {(byte) 0x0a, (byte) 0x01, (byte) 0x01, (byte) 0x0b};
and I want to change test[3], the last value which is currently the number 11 (0b), to something random.
Random generator = new Random();
int newTest3 = generator.nextInt(255);
So, now I have some random number in newTest3. I want to convert this to hex (FF) and then place that into the last element of test, or test[3].
I couldn't find much to help me on this, and I literally just picked up java a couple hours ago, so any help would be outstanding!
Thanks in advance :)