# what is this mean ">>"?

i have this code from my old colleague, can anyone tell me what does this means?

abyLic[5] = (byte) (iLicenseID >> 8);
abyLic[6] = (byte) (iLicenseID >> 16);
abyLic[7] = (byte) (iLicenseID >> 24);

abyLic[8] = (byte) (iSMSCounter);
abyLic[9] = (byte) (iSMSCounter >> 8);

the abyLic[] is an array and the iLicenseID is int.

what doest that mean by iLicenseId >> 8 ??
is that he is trying to set the value to 8 in abyLic[5]?
###### Who is Participating?

Commented:
Just to fill up with what the other experts suggested

>what doest that mean by iLicenseId >> 8 ??

The ">>" is a binary operator and it means "right shift the value in the "iLicensedId" eight times". The value of "iLicencedId" is an integer. When you right shift a value you make it smaller. For example if the "iLicencedId" holds the value of 512, which in *binary* it is 000100000000, and you right shift 8 times, it becomes 000000000010 (=2 in decimal). As you see you can see the digit 1 is moved 8 positions to the right. This is what the >> operator is doing, it moves the digits to the right.

> is that he is trying to set the value to 8 in abyLic[5]?

No, he is setting the *converted* value (the one that was shifted to the right 8 times), i.e. the result of the right-shift operation, to the 6th position os the "abyLic" array
0

Commented:
Shift right operator

0

Commented:
bitwise shift
0

Commented:
0

Commented:
0

Commented:
0

Commented:
Sorry the 512 binary should be 001000000000.
0

Commented:
taiping - why did you ignore previous correct answers?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.