Hello guys. I have a bit of a problem here... Here's a bit of code and I'll detail what I'm doing:

My problem is that whenever it goes to parse the Integer for a value over 2147483647, it'll show up as negative, and then that negative number gets XOR'd instead of the original number (e.g. 4294967293)

First, it needs to divide said number... So, math.floor(4294967293 / 65536) That should round said number down. However, considering it's over 2147483647, it just divides the negative, rounds, and finished.

Trainer ID and SID is then XOR'd, and then it XORs that together with the next two parts of the code, being this: -3 xor 0

Instead of doing this : 65535 xor 65533

The result of that calculation, if less than 8, results in a shiny pokemon. My calculator will work for the 1st 2147483648 values, but I don't know about the rest... Will my program still report if the Pokemon is Shiny correctly?

Found my math here:

http://bulbapedia.bulbagarden.net/wiki/Personality_value

Remember, my calculation is 0 xor 0 xor 65535 xor 65533

But it does this: 0 xor 0 xor -3 xor 0

- Code:

int TID = parseInt(jTextField12.getText());

int SID = parseInt(jTextField13.getText());

int PID = parseInt(jTextField3.getText());

int p1 = (int) Math.floor(PID / 65536);

int p2 = (PID % 65536);

int res = TID ^ SID ^ p1 ^ p2;

System.out.println("TID xor SID xor p1 xor p2 =" +res);

System.out.println(TID + " " + SID + " " + PID + " " + p1 + " " + p2);

if(res < 8 {

shinypkmnyn = "Pokemon is Shiny!";

}

else {

shinypkmnyn = "Pokemon is not Shiny!";

}

JOptionPane.showMessageDialog(frame,"Your PID generates a " +shinypkmnyn);

My problem is that whenever it goes to parse the Integer for a value over 2147483647, it'll show up as negative, and then that negative number gets XOR'd instead of the original number (e.g. 4294967293)

First, it needs to divide said number... So, math.floor(4294967293 / 65536) That should round said number down. However, considering it's over 2147483647, it just divides the negative, rounds, and finished.

Trainer ID and SID is then XOR'd, and then it XORs that together with the next two parts of the code, being this: -3 xor 0

Instead of doing this : 65535 xor 65533

The result of that calculation, if less than 8, results in a shiny pokemon. My calculator will work for the 1st 2147483648 values, but I don't know about the rest... Will my program still report if the Pokemon is Shiny correctly?

Found my math here:

http://bulbapedia.bulbagarden.net/wiki/Personality_value

Remember, my calculation is 0 xor 0 xor 65535 xor 65533

But it does this: 0 xor 0 xor -3 xor 0

Last edited by Reclaimer Shawn on 7/29/2016, 1:23 pm; edited 2 times in total