?
Solved

Decipher some code

Posted on 2003-02-24
4
Medium Priority
?
470 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:zaphod_beeblebrox
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 3

Accepted Solution

by:
allahabad earned 400 total points
ID: 8012060
1. count>>> 3 : Right Shift bits of count to 3 position. For ex. if count bits are 101010, after
    count>>> 3 operation, count bits position will be 000101.
2. L stands for long (primitive) type. If you do not suffix with L,  default is int type.
3. ~ negation operator means  ~(01010),  will become 10101 .
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 8012321
>>1. Can any explain what count>>> 3 means?

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.
0
 
LVL 2

Expert Comment

by:functionpointer
ID: 8014286
if you're just learning Java, digital signatures and encryption are kind of a "baptism by fire". Godspeed, Zaphod!
0
 

Author Comment

by:zaphod_beeblebrox
ID: 8015169
Thanks a million guys
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn different types of Android Layout and some basics of an Android App.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

801 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