Click here to Skip to main content
15,905,233 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,
Any body tell me what is alternative of belove java code in c#.
int i1;
int a = 45000;
i1 = a << 28 | a >>> 4;

I convert this code to c#,
i1 = a<<28 | (Int32)a>>>4

but this not give me right output.
Its greatful for me , if any body give alternative >>> And | oprtator in c#.
Give me right code.

Regards,
Ravi
Posted
Updated 9-May-11 2:48am
v3

Just to add on, have a copy of this article as long as you need help in converting Java to C# or vice-versa:
Java and C# Comparison[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 9-May-11 12:27pm    
Could be a useful reference, my 5.
--SA
Use uint instead:

MIDL
int a = 45000;
int i1 = a<<28 | (int)((uint)x >> 4);
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 9-May-11 12:28pm    
Type cast is redundant, my 4.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900