//arrays modulus and modrog
byte[] modulus ={-30, 0 , 25, 70,-25,-3,-2};
byte[] modorg=new byte[7];
//the loop that counts the elements
for (int j = 0; j < modulus.length; j++)
{
if (modulus[j] < 0)
{
modorg[j] = (byte) ((int)modulus[j] + 256);
}
else
{
modorg[j]=modorg[j];
}
}
//arrays modulus and modrog byte[] modulus ={-30, 0 , 25, 70,-25,-3,-2}; byte[] modorg=new byte[7];
Share
Adding 256 to a byte is like adding 360 to a degree 🙂
You will get the same value.
You probably want to add 128?