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
Solved

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

Posted on 2003-10-30
5
147 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

829 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