Solved

Translate 1 line Java to C# -Please help! =)

Posted on 2003-10-30
5
145 Views
Last Modified: 2010-04-16
Hi,

I'm trying to translate some Java code into c# and am running into some problems.... can anyone help translate the code below?

d^=e>>>16; g+=d; e+=f;

Note: all variables are integers.

What does "   d^= "  mean?

Thanks for any help!

/Robert
0
Comment
Question by:Robertxdj
  • 4
5 Comments
 
LVL 15

Expert Comment

by:SRigney
ID: 9650391
I think d^=e means the same thing as
d = d^e.

Similar to += and -=
0
 

Author Comment

by:Robertxdj
ID: 9650408
Thanks for your answer. But what about e>>>16;  ?
0
 
LVL 15

Expert Comment

by:SRigney
ID: 9650419
the c# code would be
d = System.Math.Pow(d, e);
g+=d;
e+=f;

I'm not sure what the >>>16 is though.
0
 
LVL 15

Expert Comment

by:SRigney
ID: 9650579
>>>  op1 >>> op2  shift bits of op1 right by distance op2 (unsigned)  
0
 
LVL 15

Accepted Solution

by:
SRigney earned 125 total points
ID: 9650612
I don't understand why it's done, but the rest of the code may explain it.

Thus your C# translation is
d = System.Math.Pow(d, (e>>16));
g+=d;
e+=f;

Operator precedence in Java forces the e>>>16 to hapen prior to the ^=
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/expressions.html
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

776 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