zaphod_beeblebrox
asked on
Decipher some code
Hi
I'm trying to learn Java and am working my way through some Java code and attempting to work out what it does before I compile it. So far, so good and, you guys have been a great help so far, but, I now need your help.
Consider these routines:
(a) private void update(byte byte0)
{
int i=(int)(count>>> 3 & 63L);
count +=8L;
buffer[i]=byte0;
if (i+63)
transform(buffer,0);
}
(b) private int G(int i, int j, int k)
{
return i & k | j & ~k;
}
1. Can any explain what count>>> 3 means?
2. What's the signficance of the "L" after the 63 and the 8?
3. In routine B what does the ~ signify before the k variable?
Class compiles OK so I guess that these are valid commands.
Any help please?
Zaphod
I'm trying to learn Java and am working my way through some Java code and attempting to work out what it does before I compile it. So far, so good and, you guys have been a great help so far, but, I now need your help.
Consider these routines:
(a) private void update(byte byte0)
{
int i=(int)(count>>> 3 & 63L);
count +=8L;
buffer[i]=byte0;
if (i+63)
transform(buffer,0);
}
(b) private int G(int i, int j, int k)
{
return i & k | j & ~k;
}
1. Can any explain what count>>> 3 means?
2. What's the signficance of the "L" after the 63 and the 8?
3. In routine B what does the ~ signify before the k variable?
Class compiles OK so I guess that these are valid commands.
Any help please?
Zaphod
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if you're just learning Java, digital signatures and encryption are kind of a "baptism by fire". Godspeed, Zaphod!
ASKER
Thanks a million guys
The important thing here is that the operator '>>>' is an *un*signed right shift, as opposed to '>>' so if the original was negative, it will end up positive after shifting.