I'm reading data from an SNES ROM using Java. I am opening a stream and reading in the bytes into an array:
InputStream stream = open("foo.rom");
final int startingSize = stream.available();
byte[] data = new byte[startingSize];
final int numberRead = stream.read(data, 0, startingSize);
In the ROM, I have this value:
E4 2B 00 02 03 00 FF 3A 00 83
228 43 0 2 3 0 255 58 0 131 (in decimal)
However, my code is behaving weirdly. After setting up some debug statements, I have this pattern when printing with String.valueOf(data[ref]):
-28 43 0 2 3 0 -1 58 0 -125
(This address in the ROM is the first where data appears, but I am noticing incorrect values elsewhere in the program.)
As near as I can tell my Java byte array is not respecting the hexadecimal data. How can I set my byte array to do so?