Solved

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

Posted on 2003-10-30
5
148 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

685 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