Solved

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

Posted on 2003-10-30
5
140 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
Comment Utility
I think d^=e means the same thing as
d = d^e.

Similar to += and -=
0
 

Author Comment

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

Expert Comment

by:SRigney
Comment Utility
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
Comment Utility
>>>  op1 >>> op2  shift bits of op1 right by distance op2 (unsigned)  
0
 
LVL 15

Accepted Solution

by:
SRigney earned 125 total points
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Put text in a picture ASP.NET C# 2 35
.xltm file opens as .xlsx file 3 36
C# remove trailing commas from csv file 10 44
Image(7) 1 32
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

9 Experts available now in Live!

Get 1:1 Help Now