Hi,
Hoping someone can help a
java newbie out, firstly I have a AFP file which has been read as a byte array(signed). I then need to search this byte array for a specific
pattern of HEX Code. Originally I had this as an integer array which made it pretty straightforward to do what I was doing but due to changes in the way the file is read I now have to deal with the signed byte array.
int endPattern[] = {0x5a,0x00,0x10,0xD3,0xA9,0xCD,0x00,0x00,0x00,0xFF,0xFF,0x40,0x40,0x40,0x40,0x40,0x40}; OLD
byte endPattern[] = {0x5a,0x00,0x10,0xD3,0xA9,0xCD,0x00,0x00,0x00,0xFF,0xFF,0x40,0x40,0x40,0x40,0x40,0x40}; CURRENT
This is the line of code i'm having difficulty with, previously the HEX i was looking for would convert to the Int array, but when I change this to Byte Array I get the loss of precision error which I believe is down to the bytes being signed in Java.
So my question is how would I convert the hex I have above into a byte array, which I can then use to search the byte array of the whole file that I currently get as input.
Any help would be greatly appreciated
Thanks in advance,