Go Premium for a chance to win a PS4. Enter to Win


what is this mean ">>"?

Posted on 2006-11-14
Medium Priority
Last Modified: 2011-09-20
i have this code from my old colleague, can anyone tell me what does this means?

abyLic[4] = (byte) (iLicenseID);
        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]?
Question by:taiping
  • 3
  • 2
  • 2
  • +1
LVL 86

Expert Comment

ID: 17945013
Shift right operator

LVL 23

Expert Comment

ID: 17945014
bitwise shift
LVL 86

Expert Comment

ID: 17945018
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 35

Accepted Solution

girionis earned 500 total points
ID: 17946486
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
LVL 35

Expert Comment

ID: 17946495
Sorry the 512 binary should be 001000000000.
LVL 86

Expert Comment

ID: 17953872
taiping - why did you ignore previous correct answers?

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This video teaches viewers about errors in exception handling.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question