I am trying to make a program that reads the PS3 PARAM.SFO file in java. I am having trouble reading the shorts and the ints. I think they are backwards in the PARAM.SFO file. Here's the code I have.
if(isOpen())
    close();
        
file = new File(path);
        
String mode = "rw";
if(!file.canWrite())
    mode = "r";
        
raf = new RandomAccessFile(path, mode);
        
byte[] mgc = new byte[4];
raf.read(mgc);
magic = new String(mgc, StandardCharsets.UTF_8);
        
if(magic.compareTo("\0PSF") != 0)
    throw new IOException("Not a valid param.sfo file");
        
majorVersion = raf.readByte();
minorVersion = raf.readByte();
reserved1 = raf.readShort();
keysOffset = raf.readInt();
valuesOffset = raf.readInt();
itemCount = raf.readInt();
        
items = new ArrayList<ParamSfoEntry>();
        
for(int i = 0; i < itemCount; i++)
     items.add(new ParamSfoEntry(raf, this, i));
Here is a screenshot of PARAM.SFO

When I try to read keysOffset in it comes out to be -469762048 and its supposed to be 228. So the program throws a negative offset error.
