byte[] stuffA = {69,96,13,37,-69,-96,-13,-37};
for(int x = 0; x < stuffA.length; x++){
if(stuffA[x] < 0){
System.out.println("Somethin be up yo! ");
System.out.println("This number be negative! " + (int)stuffA[x]);
stuffA[x] = (byte)((int)stuffA[x] + 256);
System.out.println("I added 256 and now stuff is positive yo! " + stuffA[x]);
}
}
return;
When I run this, my output is:
Somethin be up yo!
This number be negative! -69
I added 256 and now stuff is positive yo! -69
Somethin be up yo!
This number be negative! -96
I added 256 and now stuff is positive yo! -96
Somethin be up yo!
This number be negative! -13
I added 256 and now stuff is positive yo! -13
Somethin be up yo!
This number be negative! -37
I added 256 and now stuff is positive yo! -37
What is happening?