Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Different Delete Messages 7 37
Error on Add method 1 38
Connection String 16 43
Close form "before" open 3 25
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…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now